29 mBuffer.open( QIODevice::ReadWrite );
35 mHeaders.remove( key );
41 mHeaders.insert( key, value );
51 return mHeaders.value( key );
69 setHeader( QStringLiteral(
"Content-Type" ), QStringLiteral(
"text/plain; charset=utf-8" ) );
89 if ( ! mHeaders.contains(
"Content-Length" ) )
91 mHeaders.insert( QStringLiteral(
"Content-Length" ), QString::number( mBuffer.pos() ) );
100 if ( ! mHeadersSent )
106 QByteArray &ba = mBuffer.buffer();
116 mBuffer.buffer().clear();
122 return mBuffer.data();
129 mBuffer.buffer().clear();
void setStatusCode(int code) override
Set the http status code.
void flush() override
Flushes the current output buffer to the network.
QString header(const QString &key) const override
Returns the header value.
QgsBufferServerResponse()
QByteArray data() const override
Gets the data written so far.
void finish() override
Finish the response, ending the transaction.
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 afte...
void clear() override
Reset all headers and content for this response.
bool headersSent() const override
Returns true if the headers have already been sent.
void truncate() override
Truncate data.
void removeHeader(const QString &key) override
Clear header Undo a previous 'setHeader' call.
QIODevice * io() override
Returns the underlying QIODevice.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device.