QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
Class defining buffered response. More...
#include <qgsbufferserverresponse.h>
Public Member Functions | |
QgsBufferServerResponse () | |
QgsBufferServerResponse (const QgsBufferServerResponse &)=delete | |
QByteArray | body () const |
Returns body. | |
void | clear () override |
Reset all headers and content for this response. | |
QByteArray | data () const override |
Gets the data written so far. | |
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 all the headers. | |
bool | headersSent () const override |
Returns true if the headers have already been sent. | |
QIODevice * | io () override |
Returns the underlying QIODevice. | |
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. | |
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 QgsFeedback * | feedback () const |
Returns the socket feedback if any. | |
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. | |
Class defining buffered response.
Definition at line 36 of file qgsbufferserverresponse.h.
QgsBufferServerResponse::QgsBufferServerResponse | ( | ) |
Definition at line 27 of file qgsbufferserverresponse.cpp.
|
delete |
|
inline |
Returns body.
Definition at line 136 of file qgsbufferserverresponse.h.
|
overridevirtual |
Reset all headers and content for this response.
Implements QgsServerResponse.
Definition at line 112 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
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 120 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
Finish the response, ending the transaction.
Reimplemented from QgsServerResponse.
Definition at line 79 of file qgsbufferserverresponse.cpp.
|
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()'.
Reimplemented from QgsServerResponse.
Definition at line 98 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
Returns the header value.
Implements QgsServerResponse.
Definition at line 49 of file qgsbufferserverresponse.cpp.
|
inlineoverridevirtual |
Returns all the headers.
Implements QgsServerResponse.
Definition at line 63 of file qgsbufferserverresponse.h.
|
overridevirtual |
Returns true
if the headers have already been sent.
Implements QgsServerResponse.
Definition at line 54 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
Returns the underlying QIODevice.
Implements QgsServerResponse.
Definition at line 74 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
Clear header Undo a previous 'setHeader' call.
Implements QgsServerResponse.
Definition at line 32 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
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 |
Implements QgsServerResponse.
Definition at line 59 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
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 38 of file qgsbufferserverresponse.cpp.
|
overridevirtual |
Set the http status code.
code | HTTP status code value |
Implements QgsServerResponse.
Definition at line 44 of file qgsbufferserverresponse.cpp.
|
inlineoverridevirtual |
Returns the http status code.
Implements QgsServerResponse.
Definition at line 79 of file qgsbufferserverresponse.h.
|
overridevirtual |
Truncate data.
Clear internal buffer
Implements QgsServerResponse.
Definition at line 126 of file qgsbufferserverresponse.cpp.