QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsfilterresponsedecorator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfilterresponsedecorator.h
3
4 Define response adapter for handling filter's hooks
5 -------------------
6 begin : 2017-01-05
7 copyright : (C) 2017 by David Marteau
8 email : david dot marteau at 3liz dot com
9 ***************************************************************************/
10
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19#ifndef QGSFILTERRESPONSEDECORATOR_H
20#define QGSFILTERRESPONSEDECORATOR_H
21
22#define SIP_NO_FILE
23
24
25#include "qgsserverresponse.h"
26#include "qgsserverfilter.h"
27#include "qgsserverexception.h"
28
35{
36 public:
37
44
48 void start() SIP_THROW( QgsServerException ) SIP_VIRTUALERRORHANDLER( server_exception_handler );
49
54 void ready() SIP_THROW( QgsServerException ) SIP_VIRTUALERRORHANDLER( server_exception_handler );
55
56 // QgsServerResponse overrides
57
58 void setHeader( const QString &key, const QString &value ) override { mResponse.setHeader( key, value ); }
59
60 void removeHeader( const QString &key ) override { mResponse.removeHeader( key ); }
61
62 QString header( const QString &key ) const override { return mResponse.header( key ); }
63
64 QMap<QString, QString> headers() const override { return mResponse.headers(); }
65
66 bool headersSent() const override { return mResponse.headersSent(); }
67
68 void setStatusCode( int code ) override { mResponse.setStatusCode( code ); }
69
70 int statusCode() const override { return mResponse.statusCode(); }
71
72 void sendError( int code, const QString &message ) override { mResponse.sendError( code, message ); }
73
74 QIODevice *io() override { return mResponse.io(); }
75
76 void finish() override;
77
78 void flush() override;
79
80 void clear() override { mResponse.clear(); }
81
82 QByteArray data() const override { return mResponse.data(); }
83
84 void truncate() override { mResponse.truncate(); }
85
86 QgsFeedback *feedback() const override { return mResponse.feedback(); }
87
88 private:
89 QgsServerFiltersMap mFilters;
90 QgsServerResponse &mResponse;
91};
92
93#endif
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Class defining decorator for calling filter's hooks.
void clear() override
Reset all headers and content for this response.
int statusCode() const override
Returns the http status code.
void sendError(int code, const QString &message) override
Send error This method delegates error handling at the server level.
QgsFeedback * feedback() const override
Returns the socket feedback if any.
QIODevice * io() override
Returns the underlying QIODevice.
void flush() override
Flushes the current output buffer to the network.
void start()
Call filters requestReady() method.
void finish() override
Finish the response, ending the transaction.
void removeHeader(const QString &key) override
Clear header Undo a previous 'setHeader' call.
void setStatusCode(int code) override
Set the http status code.
QByteArray data() const override
Gets the data written so far.
void truncate() override
Truncate data.
bool headersSent() const override
Returns true if the headers have already been sent.
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 ready()
Call filters projectReady() method.
QString header(const QString &key) const override
Returns the header value.
QMap< QString, QString > headers() const override
Returns the header value.
Exception base class for server exceptions.
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 int statusCode() const =0
Returns the http status code.
virtual void truncate()=0
Truncate data.
virtual QMap< QString, QString > headers() const =0
Returns the header value.
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 QgsFeedback * feedback() const
Returns the socket feedback if any.
virtual void clear()=0
Reset all headers and content for this response.
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.
#define SIP_VIRTUALERRORHANDLER(name)
Definition qgis_sip.h:196
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap