QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsFilterResponseDecorator Class Reference

Class defining decorator for calling filter's hooks. More...

#include <qgsfilterresponsedecorator.h>

Inheritance diagram for QgsFilterResponseDecorator:
Inheritance graph
[legend]

Public Member Functions

 QgsFilterResponseDecorator (QgsServerFiltersMap filters, QgsServerResponse &response)
 Constructor for QgsFilterResponseDecorator.
 
void clear () override
 Reset all headers and content for this response.
 
QByteArray data () const override
 Gets the data written so far.
 
QgsFeedbackfeedback () const override
 Returns the socket feedback if any.
 
void finish () override
 Finish the response, ending the transaction.
 
void flush () override
 Flushes the current output buffer to the network.
 
QString header (const QString &key) const override
 Returns the header value.
 
QMap< QString, QString > headers () const override
 Returns the header value.
 
bool headersSent () const override
 Returns true if the headers have already been sent.
 
QIODevice * io () override
 Returns the underlying QIODevice.
 
void ready ()
 Call filters projectReady() method.
 
void removeHeader (const QString &key) override
 Clear header Undo a previous 'setHeader' call.
 
void sendError (int code, const QString &message) override
 Send error This method delegates error handling at the server level.
 
void setHeader (const QString &key, const QString &value) override
 Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire.
 
void setStatusCode (int code) override
 Set the http status code.
 
void start ()
 Call filters requestReady() method.
 
int statusCode () const override
 Returns the http status code.
 
void truncate () override
 Truncate data.
 
- Public Member Functions inherited from QgsServerResponse
 QgsServerResponse ()=default
 
virtual ~QgsServerResponse ()=default
 
virtual qint64 write (const char *data)
 Writes at most maxSize bytes of data.
 
virtual qint64 write (const char *data, qint64 maxsize)
 Writes at most maxSize bytes of data.
 
virtual qint64 write (const QByteArray &byteArray)
 Write chunk of data This is a convenient method that will write directly to the underlying I/O device.
 
virtual void write (const QgsServerException &ex)
 Write server exception.
 
virtual void write (const QString &data)
 Write string This is a convenient method that will write directly to the underlying I/O device.
 
virtual qint64 write (std::string data)
 Writes at most maxSize bytes of data.
 

Detailed Description

Class defining decorator for calling filter's hooks.

Definition at line 34 of file qgsfilterresponsedecorator.h.

Constructor & Destructor Documentation

◆ QgsFilterResponseDecorator()

QgsFilterResponseDecorator::QgsFilterResponseDecorator ( QgsServerFiltersMap  filters,
QgsServerResponse response 
)

Constructor for QgsFilterResponseDecorator.

Parameters
filtersMap of filters to apply before terminating the response
responseServer response

Definition at line 23 of file qgsfilterresponsedecorator.cpp.

Member Function Documentation

◆ clear()

void QgsFilterResponseDecorator::clear ( )
inlineoverridevirtual

Reset all headers and content for this response.

Implements QgsServerResponse.

Definition at line 80 of file qgsfilterresponsedecorator.h.

◆ data()

QByteArray QgsFilterResponseDecorator::data ( ) const
inlineoverridevirtual

Gets the data written so far.

This is implementation dependent: some implementations may not give access to the underlying and return an empty array.

Note that each call to 'flush' may empty the buffer and in case of streaming process you may get partial content

Implements QgsServerResponse.

Definition at line 82 of file qgsfilterresponsedecorator.h.

◆ feedback()

QgsFeedback * QgsFilterResponseDecorator::feedback ( ) const
inlineoverridevirtual

Returns the socket feedback if any.

Since
QGIS 3.36

Reimplemented from QgsServerResponse.

Definition at line 86 of file qgsfilterresponsedecorator.h.

◆ finish()

void QgsFilterResponseDecorator::finish ( )
overridevirtual

Finish the response, ending the transaction.

The default implementation does nothing.

Reimplemented from QgsServerResponse.

Definition at line 59 of file qgsfilterresponsedecorator.cpp.

◆ flush()

void QgsFilterResponseDecorator::flush ( )
overridevirtual

Flushes the current output buffer to the network.

'flush()' may be called multiple times. For HTTP transactions headers will be written on the first call to 'flush()'. The default implementation does nothing.

Reimplemented from QgsServerResponse.

Definition at line 78 of file qgsfilterresponsedecorator.cpp.

◆ header()

QString QgsFilterResponseDecorator::header ( const QString &  key) const
inlineoverridevirtual

Returns the header value.

Implements QgsServerResponse.

Definition at line 62 of file qgsfilterresponsedecorator.h.

◆ headers()

QMap< QString, QString > QgsFilterResponseDecorator::headers ( ) const
inlineoverridevirtual

Returns the header value.

Implements QgsServerResponse.

Definition at line 64 of file qgsfilterresponsedecorator.h.

◆ headersSent()

bool QgsFilterResponseDecorator::headersSent ( ) const
inlineoverridevirtual

Returns true if the headers have already been sent.

Implements QgsServerResponse.

Definition at line 66 of file qgsfilterresponsedecorator.h.

◆ io()

QIODevice * QgsFilterResponseDecorator::io ( )
inlineoverridevirtual

Returns the underlying QIODevice.

Implements QgsServerResponse.

Definition at line 74 of file qgsfilterresponsedecorator.h.

◆ ready()

void QgsFilterResponseDecorator::ready ( )

Call filters projectReady() method.

Since
QGIS 3.36

Definition at line 44 of file qgsfilterresponsedecorator.cpp.

◆ removeHeader()

void QgsFilterResponseDecorator::removeHeader ( const QString &  key)
inlineoverridevirtual

Clear header Undo a previous 'setHeader' call.

Implements QgsServerResponse.

Definition at line 60 of file qgsfilterresponsedecorator.h.

◆ sendError()

void QgsFilterResponseDecorator::sendError ( int  code,
const QString &  message 
)
inlineoverridevirtual

Send error This method delegates error handling at the server level.

This is different from calling setReturnCode() which let you return a specific response body. Calling sendError() will end the transaction and any attempt to write data or set headers will be an error.

Parameters
codeHHTP return code value
messageAn informative error message

Implements QgsServerResponse.

Definition at line 72 of file qgsfilterresponsedecorator.h.

◆ setHeader()

void QgsFilterResponseDecorator::setHeader ( const QString &  key,
const QString &  value 
)
inlineoverridevirtual

Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire.

Implements QgsServerResponse.

Definition at line 58 of file qgsfilterresponsedecorator.h.

◆ setStatusCode()

void QgsFilterResponseDecorator::setStatusCode ( int  code)
inlineoverridevirtual

Set the http status code.

Parameters
codeHTTP status code value

Implements QgsServerResponse.

Definition at line 68 of file qgsfilterresponsedecorator.h.

◆ start()

void QgsFilterResponseDecorator::start ( )

Call filters requestReady() method.

Definition at line 29 of file qgsfilterresponsedecorator.cpp.

◆ statusCode()

int QgsFilterResponseDecorator::statusCode ( ) const
inlineoverridevirtual

Returns the http status code.

Implements QgsServerResponse.

Definition at line 70 of file qgsfilterresponsedecorator.h.

◆ truncate()

void QgsFilterResponseDecorator::truncate ( )
inlineoverridevirtual

Truncate data.

Clear internal buffer

Implements QgsServerResponse.

Definition at line 84 of file qgsfilterresponsedecorator.h.


The documentation for this class was generated from the following files: