QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() method. More...
#include <qgsserverresponse.h>
Public Member Functions | |
QgsServerResponse ()=default | |
virtual | ~QgsServerResponse ()=default |
virtual void | clear ()=0 |
Reset all headers and content for this response. | |
virtual QByteArray | data () const =0 |
Gets the data written so far. | |
virtual QgsFeedback * | feedback () const |
Returns the socket feedback if any. | |
virtual void | finish () |
Finish the response, ending the transaction. | |
virtual void | flush () |
Flushes the current output buffer to the network. | |
virtual QString | header (const QString &key) const =0 |
Returns the header value. | |
virtual QMap< QString, QString > | headers () const =0 |
Returns the header value. | |
virtual bool | headersSent () const =0 |
Returns true if the headers have already been sent. | |
virtual QIODevice * | io ()=0 |
Returns the underlying QIODevice. | |
virtual void | removeHeader (const QString &key)=0 |
Clear header Undo a previous 'setHeader' call. | |
virtual void | sendError (int code, const QString &message)=0 |
Send error This method delegates error handling at the server level. | |
virtual void | setHeader (const QString &key, const QString &value)=0 |
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. | |
virtual void | setStatusCode (int code)=0 |
Set the http status code. | |
virtual int | statusCode () const =0 |
Returns the http status code. | |
virtual void | truncate ()=0 |
Truncate data. | |
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. | |
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() method.
Definition at line 43 of file qgsserverresponse.h.
|
default |
|
virtualdefault |
|
pure virtual |
Reset all headers and content for this response.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
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
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
virtual |
Returns the socket feedback if any.
Reimplemented in QgsFcgiServerResponse, and QgsFilterResponseDecorator.
Definition at line 98 of file qgsserverresponse.cpp.
|
virtual |
Finish the response, ending the transaction.
The default implementation does nothing.
Reimplemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
Definition at line 68 of file qgsserverresponse.cpp.
|
virtual |
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 in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
Definition at line 72 of file qgsserverresponse.cpp.
|
pure virtual |
Returns the header value.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Returns the header value.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Returns true
if the headers have already been sent.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Returns the underlying QIODevice.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Clear header Undo a previous 'setHeader' call.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
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.
code | HHTP return code value |
message | An informative error message |
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
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.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Set the http status code.
code | HTTP status code value |
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Returns the http status code.
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
pure virtual |
Truncate data.
Clear internal buffer
Implemented in QgsBufferServerResponse, QgsFcgiServerResponse, and QgsFilterResponseDecorator.
|
virtual |
Writes at most maxSize bytes of data.
This is a convenient method that will write directly to the underlying I/O device
Definition at line 58 of file qgsserverresponse.cpp.
|
virtual |
Writes at most maxSize bytes of data.
This is a convenient method that will write directly to the underlying I/O device
Definition at line 48 of file qgsserverresponse.cpp.
|
virtual |
Write chunk of data This is a convenient method that will write directly to the underlying I/O device.
Definition at line 38 of file qgsserverresponse.cpp.
|
virtual |
Write server exception.
Definition at line 81 of file qgsserverresponse.cpp.
|
virtual |
Write string This is a convenient method that will write directly to the underlying I/O device.
Definition at line 25 of file qgsserverresponse.cpp.
|
virtual |
Writes at most maxSize bytes of data.
This is a convenient method that will write directly to the underlying I/O device
Definition at line 76 of file qgsserverresponse.cpp.