19#ifndef QGSBUFFERSERVERRESPONSE_H
20#define QGSBUFFERSERVERRESPONSE_H
22#include "qgis_server.h"
51 void setHeader(
const QString &key,
const QString &value )
override;
62 QString
header(
const QString &key )
const override;
67 QMap<QString, QString>
headers()
const override {
return mHeaders; }
94 void sendError(
int code,
const QString &message )
override;
99 QIODevice *
io()
override;
112 void flush()
override;
117 void clear()
override;
128 QByteArray
data()
const override;
140 QByteArray
body()
const {
return mBody; }
149 QMap<QString, QString> mHeaders;
152 bool mFinished =
false;
153 bool mHeadersSent =
false;
154 int mStatusCode = 200;
Class defining buffered response.
QMap< QString, QString > headers() const override
Returns all the headers.
QgsBufferServerResponse(const QgsBufferServerResponse &)=delete
QgsBufferServerResponse cannot be copied.
QByteArray body() const
Returns body.
int statusCode() const override
Returns the http status code.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void removeHeader(const QString &key)=0
Clear header Undo a previous 'setHeader' call.
virtual void truncate()=0
Truncate data.
virtual void flush()
Flushes the current output buffer to the network.
virtual QByteArray data() const =0
Gets the data written so far.
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 afte...
virtual void clear()=0
Reset all headers and content for this response.
virtual void finish()
Finish the response, ending the transaction.
virtual bool headersSent() const =0
Returns true if the headers have already been sent.
virtual void sendError(int code, const QString &message)=0
Send error This method delegates error handling at the server level.
virtual QIODevice * io()=0
Returns the underlying QIODevice.
virtual QString header(const QString &key) const =0
Returns the header value.
virtual void setStatusCode(int code)=0
Set the http status code.