QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsrequesthandler.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshttprequesthandler.h
3 -----------------------
4 begin : June 29, 2007
5 copyright : (C) 2007 by Marco Hugentobler
6 (C) 2014 by Alessandro Pasotti
7 email : marco dot hugentobler at karto dot baug dot ethz dot ch
8 a dot pasotti at itopen dot it
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
20#ifndef QGSREQUESTHANDLER_H
21#define QGSREQUESTHANDLER_H
22
23#include <QMap>
24#include "qgis_sip.h"
25#include <QString>
26
27#include "qgis_server.h"
28
32
38class SERVER_EXPORT QgsRequestHandler
39{
40 public:
46 explicit QgsRequestHandler( QgsServerRequest &request, QgsServerResponse &response );
47
49 void setServiceException( const QgsServerException &ex );
50
57 void sendResponse();
58
60 void setResponseHeader( const QString &name, const QString &value );
61
63 void removeResponseHeader( const QString &name );
64
66 QString responseHeader( const QString &name ) const;
67
69 QMap<QString, QString> responseHeaders() const;
70
72 void setRequestHeader( const QString &name, const QString &value );
73
75 void removeRequestHeader( const QString &name );
76
78 QString requestHeader( const QString &name ) const;
79
81 QMap<QString, QString> requestHeaders() const;
82
84 void clear();
85
87 void appendBody( const QByteArray &body );
88
90 bool exceptionRaised() const;
91
93 void clearBody();
94
96 QByteArray body() const;
97
99 QByteArray data() const;
100
102 QString url() const;
103
108 QString path() const;
109
111 void setStatusCode( int code );
112
114 int statusCode() const;
115
121 QMap<QString, QString> parameterMap() const;
122
124 void setParameter( const QString &key, const QString &value );
125
127 QString parameter( const QString &key ) const;
128
130 void removeParameter( const QString &key );
131
136 void parseInput() SIP_SKIP;
137
139 QString format() const { return mFormat; }
140
142 bool headersSent() const;
143
144 private:
145#ifdef SIP_RUN
146 QgsRequestHandler &operator=( const QgsRequestHandler & );
147#endif
148
149 void setupParameters();
150
152 QString mFormat;
153 QString mFormatString; //format string as it is passed in the request (with base)
154 QString mService;
155 bool mExceptionRaised;
156
157 QgsServerRequest &mRequest;
158 QgsServerResponse &mResponse;
159};
160
161#endif
This class is an interface hiding the details of reading input and writing output from/to a wms reque...
QString format() const
Returns the requested format string.
Exception base class for server exceptions.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
#define SIP_SKIP
Definition qgis_sip.h:126