19#ifndef QGSFCGISERVERRESPONSE_H
20#define QGSFCGISERVERRESPONSE_H
59 std::atomic_bool mShouldStop;
60 std::shared_ptr<QgsFeedback> mFeedback;
64 std::timed_mutex mMutex;
83 void setHeader(
const QString &key,
const QString &value )
override;
87 QString
header(
const QString &key )
const override;
89 QMap<QString, QString>
headers()
const override;
91 QList<QString>
fullHeader(
const QString &key )
const override;
93 QMap<QString, QList<QString>>
fullHeaders()
const override {
return mHeaders; }
101 void sendError(
int code,
const QString &message )
override;
103 QIODevice *
io()
override;
107 void flush()
override;
109 void clear()
override;
111 QByteArray
data()
const override;
118 void setDefaultHeaders();
126 void addHeader(
const QString &key,
const QString &value )
override;
129 QMap<QString, QList<QString>> mHeaders;
131 bool mFinished =
false;
132 bool mHeadersSent =
false;
137 std::unique_ptr<QgsSocketMonitoringThread> mSocketMonitoringThread;
141 std::shared_ptr<QgsFeedback> mFeedback;
QgsFeedback * feedback() const override
Returns socket feedback if any.
QMap< QString, QList< QString > > fullHeaders() const override
Returns all the header values.
QgsFcgiServerResponse(QgsServerRequest::Method method=QgsServerRequest::GetMethod)
Constructor for QgsFcgiServerResponse.
int statusCode() const override
Returns the http status code.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Method
HTTP Method (or equivalent) used for the request.
virtual void removeHeader(const QString &key)=0
Clear all header values for the given key Undo a previous 'setHeader' call.
virtual void truncate()=0
Truncate data.
virtual void flush()
Flushes the current output buffer to the network.
virtual Q_DECL_DEPRECATED QString header(const QString &key) const =0
Returns a single header value for a given key.
virtual QList< QString > fullHeader(const QString &key) const =0
Returns a (possibly empty) list of all the header values for the given key.
virtual Q_DECL_DEPRECATED QMap< QString, QString > headers() const =0
Returns the header values as a map: only the last value is returned if multiple values are set for th...
virtual QByteArray data() const =0
Gets the data written so far.
virtual void setHeader(const QString &key, const QString &value)=0
Set a single header value replacing any existing value(s) for the same key.
virtual void addHeader(const QString &key, const QString &value)=0
Add a header value for the given key, without replacing any existing value for the same key Add Heade...
virtual void clear()=0
Reset all headers and content for this response.
QgsServerResponse()=default
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 void setStatusCode(int code)=0
Set the http status code.
void run()
main thread function
void stop()
Stop the thread.
QgsSocketMonitoringThread(std::shared_ptr< QgsFeedback > feedback)
Constructor for QgsSocketMonitoringThread.