QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() method. More...
#include <qgsserverrequest.h>
Public Types | |
typedef QMap< QString, QString > | Headers |
enum | Method { HeadMethod , PutMethod , GetMethod , PostMethod , DeleteMethod , PatchMethod } |
HTTP Method (or equivalent) used for the request. More... | |
typedef QMap< QString, QString > | Parameters |
enum | RequestHeader { HOST , FORWARDED , X_FORWARDED_FOR , X_FORWARDED_HOST , X_FORWARDED_PROTO , X_QGIS_SERVICE_URL , X_QGIS_WMS_SERVICE_URL , X_QGIS_WFS_SERVICE_URL , X_QGIS_WCS_SERVICE_URL , X_QGIS_WMTS_SERVICE_URL , ACCEPT , USER_AGENT , AUTHORIZATION } |
The internal HTTP Header used for the request as enum. More... | |
Public Member Functions | |
QgsServerRequest ()=default | |
QgsServerRequest (const QgsServerRequest &other) | |
QgsServerRequest (const QString &url, QgsServerRequest::Method method=QgsServerRequest::GetMethod, const QgsServerRequest::Headers &headers=QgsServerRequest::Headers()) | |
Constructor. | |
QgsServerRequest (const QUrl &url, QgsServerRequest::Method method=QgsServerRequest::GetMethod, const QgsServerRequest::Headers &headers=QgsServerRequest::Headers()) | |
Constructor. | |
virtual | ~QgsServerRequest ()=default |
QUrl | baseUrl () const |
Returns the base URL of QGIS server. | |
virtual QByteArray | data () const |
Returns post/put data Check for QByteArray::isNull() to check if data is available. | |
virtual QString | header (const QString &name) const |
Returns the header value. | |
virtual QString | header (const RequestHeader &headerEnum) const |
Returns the header value. | |
QMap< QString, QString > | headers () const |
Returns the header map. | |
QgsServerRequest::Method | method () const |
QgsServerRequest & | operator= (const QgsServerRequest &)=default |
QUrl | originalUrl () const |
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS server. | |
QString | parameter (const QString &key, const QString &defaultValue=QString()) const |
Gets a parameter value. | |
QgsServerRequest::Parameters | parameters () const |
Returns a map of query parameters with keys converted to uppercase. | |
const QString | queryParameter (const QString &name, const QString &defaultValue=QString()) const |
Returns the query string parameter with the given name from the request URL, a defaultValue can be specified. | |
void | removeHeader (const QString &name) |
Remove an header. | |
virtual void | removeParameter (const QString &key) |
Remove a parameter. | |
QgsServerParameters | serverParameters () const |
Returns parameters. | |
void | setHeader (const QString &name, const QString &value) |
Set an header. | |
void | setMethod (QgsServerRequest::Method method) |
Set the request method. | |
virtual void | setParameter (const QString &key, const QString &value) |
Set a parameter. | |
virtual void | setUrl (const QUrl &url) |
Set the request url. | |
QUrl | url () const |
Static Public Member Functions | |
static QString | methodToString (const Method &method) |
Returns a string representation of an HTTP request method. | |
Protected Member Functions | |
void | setBaseUrl (const QUrl &url) |
Set the base URL of QGIS server. | |
void | setOriginalUrl (const QUrl &url) |
Set the request original url (the request url as seen by the web server) | |
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() method.
Definition at line 36 of file qgsserverrequest.h.
typedef QMap<QString, QString> QgsServerRequest::Headers |
Definition at line 43 of file qgsserverrequest.h.
typedef QMap<QString, QString> QgsServerRequest::Parameters |
Definition at line 42 of file qgsserverrequest.h.
HTTP Method (or equivalent) used for the request.
Enumerator | |
---|---|
HeadMethod | |
PutMethod | |
GetMethod | |
PostMethod | |
DeleteMethod | |
PatchMethod |
Definition at line 48 of file qgsserverrequest.h.
The internal HTTP Header used for the request as enum.
Enumerator | |
---|---|
HOST | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host. |
FORWARDED | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded, https://tools.ietf.org/html/rfc7239. |
X_FORWARDED_FOR | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For. |
X_FORWARDED_HOST | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host. |
X_FORWARDED_PROTO | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto. |
X_QGIS_SERVICE_URL | The QGIS service URL. |
X_QGIS_WMS_SERVICE_URL | The QGIS WMS service URL. |
X_QGIS_WFS_SERVICE_URL | The QGIS WFS service URL. |
X_QGIS_WCS_SERVICE_URL | The QGIS WCS service URL. |
X_QGIS_WMTS_SERVICE_URL | The QGIS WMTS service URL. |
ACCEPT | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept. |
USER_AGENT | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent. |
AUTHORIZATION | Https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization. |
Definition at line 62 of file qgsserverrequest.h.
|
default |
QgsServerRequest::QgsServerRequest | ( | const QString & | url, |
QgsServerRequest::Method | method = QgsServerRequest::GetMethod , |
||
const QgsServerRequest::Headers & | headers = QgsServerRequest::Headers() |
||
) |
Constructor.
url | the url string |
method | the request method |
headers |
Definition at line 26 of file qgsserverrequest.cpp.
QgsServerRequest::QgsServerRequest | ( | const QUrl & | url, |
QgsServerRequest::Method | method = QgsServerRequest::GetMethod , |
||
const QgsServerRequest::Headers & | headers = QgsServerRequest::Headers() |
||
) |
Constructor.
url | QUrl |
method | the request method |
headers |
Definition at line 31 of file qgsserverrequest.cpp.
QgsServerRequest::QgsServerRequest | ( | const QgsServerRequest & | other | ) |
Definition at line 41 of file qgsserverrequest.cpp.
|
virtualdefault |
QUrl QgsServerRequest::baseUrl | ( | ) | const |
Returns the base URL of QGIS server.
E.g. if we call QGIS server with http://example.com/folder?REQUEST=WMS&...
the base URL will be http://example.com/folder
Definition at line 102 of file qgsserverrequest.cpp.
|
virtual |
Returns post/put data Check for QByteArray::isNull() to check if data is available.
Reimplemented in QgsBufferServerRequest, and QgsFcgiServerRequest.
Definition at line 127 of file qgsserverrequest.cpp.
|
virtual |
Returns the header value.
name | of the header |
Reimplemented in QgsFcgiServerRequest.
Definition at line 57 of file qgsserverrequest.cpp.
|
virtual |
Returns the header value.
headerEnum | of the header |
Definition at line 63 of file qgsserverrequest.cpp.
QMap< QString, QString > QgsServerRequest::headers | ( | ) | const |
QgsServerRequest::Method QgsServerRequest::method | ( | ) | const |
Definition at line 112 of file qgsserverrequest.cpp.
|
static |
Returns a string representation of an HTTP request method.
Definition at line 51 of file qgsserverrequest.cpp.
|
default |
QUrl QgsServerRequest::originalUrl | ( | ) | const |
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS server.
Definition at line 92 of file qgsserverrequest.cpp.
QString QgsServerRequest::parameter | ( | const QString & | key, |
const QString & | defaultValue = QString() |
||
) | const |
Gets a parameter value.
Definition at line 138 of file qgsserverrequest.cpp.
QMap< QString, QString > QgsServerRequest::parameters | ( | ) | const |
Returns a map of query parameters with keys converted to uppercase.
Definition at line 117 of file qgsserverrequest.cpp.
const QString QgsServerRequest::queryParameter | ( | const QString & | name, |
const QString & | defaultValue = QString( ) |
||
) | const |
Returns the query string parameter with the given name from the request URL, a defaultValue can be specified.
Definition at line 166 of file qgsserverrequest.cpp.
void QgsServerRequest::removeHeader | ( | const QString & | name | ) |
Remove an header.
name |
Definition at line 82 of file qgsserverrequest.cpp.
|
virtual |
Remove a parameter.
Reimplemented in QgsWms::QgsWmsRequest.
Definition at line 148 of file qgsserverrequest.cpp.
QgsServerParameters QgsServerRequest::serverParameters | ( | ) | const |
Returns parameters.
Definition at line 122 of file qgsserverrequest.cpp.
|
protected |
Set the base URL of QGIS server.
Definition at line 107 of file qgsserverrequest.cpp.
void QgsServerRequest::setHeader | ( | const QString & | name, |
const QString & | value | ||
) |
void QgsServerRequest::setMethod | ( | QgsServerRequest::Method | method | ) |
Set the request method.
Definition at line 161 of file qgsserverrequest.cpp.
|
protected |
Set the request original url (the request url as seen by the web server)
Definition at line 97 of file qgsserverrequest.cpp.
|
virtual |
Set a parameter.
Reimplemented in QgsWms::QgsWmsRequest.
Definition at line 132 of file qgsserverrequest.cpp.
|
virtual |
Set the request url.
Reimplemented in QgsWms::QgsWmsRequest.
Definition at line 154 of file qgsserverrequest.cpp.
QUrl QgsServerRequest::url | ( | ) | const |
Definition at line 87 of file qgsserverrequest.cpp.