QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsServerRequest Class Reference

QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() method. More...

#include <qgsserverrequest.h>

Inheritance diagram for QgsServerRequest:
Inheritance graph
[legend]

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
 Constructor.
 
 QgsServerRequest (const QgsServerRequest &other)
 Copy constructor.
 
 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
 destructor
 
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
 
QgsServerRequestoperator= (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)
 

Detailed Description

QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() method.

Since
QGIS 3.0

Definition at line 38 of file qgsserverrequest.h.

Member Typedef Documentation

◆ Headers

typedef QMap<QString, QString> QgsServerRequest::Headers

Definition at line 45 of file qgsserverrequest.h.

◆ Parameters

typedef QMap<QString, QString> QgsServerRequest::Parameters

Definition at line 44 of file qgsserverrequest.h.

Member Enumeration Documentation

◆ Method

HTTP Method (or equivalent) used for the request.

Enumerator
HeadMethod 
PutMethod 
GetMethod 
PostMethod 
DeleteMethod 
PatchMethod 

Definition at line 50 of file qgsserverrequest.h.

◆ RequestHeader

The internal HTTP Header used for the request as enum.

Enumerator
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 

Definition at line 64 of file qgsserverrequest.h.

Constructor & Destructor Documentation

◆ QgsServerRequest() [1/4]

QgsServerRequest::QgsServerRequest ( )
default

Constructor.

◆ QgsServerRequest() [2/4]

QgsServerRequest::QgsServerRequest ( const QString &  url,
QgsServerRequest::Method  method = QgsServerRequest::GetMethod,
const QgsServerRequest::Headers headers = QgsServerRequest::Headers() 
)

Constructor.

Parameters
urlthe url string
methodthe request method
headers

Definition at line 25 of file qgsserverrequest.cpp.

◆ QgsServerRequest() [3/4]

QgsServerRequest::QgsServerRequest ( const QUrl &  url,
QgsServerRequest::Method  method = QgsServerRequest::GetMethod,
const QgsServerRequest::Headers headers = QgsServerRequest::Headers() 
)

Constructor.

Parameters
urlQUrl
methodthe request method
headers

Definition at line 30 of file qgsserverrequest.cpp.

◆ QgsServerRequest() [4/4]

QgsServerRequest::QgsServerRequest ( const QgsServerRequest other)

Copy constructor.

Definition at line 40 of file qgsserverrequest.cpp.

◆ ~QgsServerRequest()

virtual QgsServerRequest::~QgsServerRequest ( )
virtualdefault

destructor

Member Function Documentation

◆ baseUrl()

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'

Since
QGIS 3.20

Definition at line 101 of file qgsserverrequest.cpp.

◆ data()

QByteArray QgsServerRequest::data ( ) const
virtual

Returns post/put data Check for QByteArray::isNull() to check if data is available.

Reimplemented in QgsBufferServerRequest, and QgsFcgiServerRequest.

Definition at line 126 of file qgsserverrequest.cpp.

◆ header() [1/2]

QString QgsServerRequest::header ( const QString &  name) const
virtual

Returns the header value.

Parameters
nameof the header
Returns
the header value or an empty string

Reimplemented in QgsFcgiServerRequest.

Definition at line 56 of file qgsserverrequest.cpp.

◆ header() [2/2]

QString QgsServerRequest::header ( const RequestHeader headerEnum) const
virtual

Returns the header value.

Parameters
headerEnumof the header
Returns
the header value or an empty string

Definition at line 62 of file qgsserverrequest.cpp.

◆ headers()

QMap< QString, QString > QgsServerRequest::headers ( ) const

Returns the header map.

Returns
the headers map

Definition at line 76 of file qgsserverrequest.cpp.

◆ method()

QgsServerRequest::Method QgsServerRequest::method ( ) const
Returns
the request method

Definition at line 111 of file qgsserverrequest.cpp.

◆ methodToString()

QString QgsServerRequest::methodToString ( const Method method)
static

Returns a string representation of an HTTP request method.

Since
QGIS 3.12

Definition at line 50 of file qgsserverrequest.cpp.

◆ operator=()

QgsServerRequest & QgsServerRequest::operator= ( const QgsServerRequest )
default

◆ originalUrl()

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.

See also
url() for the rewritten url
Since
QGIS 3.6

Definition at line 91 of file qgsserverrequest.cpp.

◆ parameter()

QString QgsServerRequest::parameter ( const QString &  key,
const QString &  defaultValue = QString() 
) const

Gets a parameter value.

Definition at line 137 of file qgsserverrequest.cpp.

◆ parameters()

QMap< QString, QString > QgsServerRequest::parameters ( ) const

Returns a map of query parameters with keys converted to uppercase.

Definition at line 116 of file qgsserverrequest.cpp.

◆ queryParameter()

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.

Since
QGIS 3.10

Definition at line 165 of file qgsserverrequest.cpp.

◆ removeHeader()

void QgsServerRequest::removeHeader ( const QString &  name)

Remove an header.

Parameters
name
Since
QGIS 3.20

Definition at line 81 of file qgsserverrequest.cpp.

◆ removeParameter()

void QgsServerRequest::removeParameter ( const QString &  key)
virtual

Remove a parameter.

Reimplemented in QgsWms::QgsWmsRequest.

Definition at line 147 of file qgsserverrequest.cpp.

◆ serverParameters()

QgsServerParameters QgsServerRequest::serverParameters ( ) const

Returns parameters.

Definition at line 121 of file qgsserverrequest.cpp.

◆ setBaseUrl()

void QgsServerRequest::setBaseUrl ( const QUrl &  url)
protected

Set the base URL of QGIS server.

Since
QGIS 3.20

Definition at line 106 of file qgsserverrequest.cpp.

◆ setHeader()

void QgsServerRequest::setHeader ( const QString &  name,
const QString &  value 
)

Set an header.

Parameters
name
value

Definition at line 71 of file qgsserverrequest.cpp.

◆ setMethod()

void QgsServerRequest::setMethod ( QgsServerRequest::Method  method)

Set the request method.

Definition at line 160 of file qgsserverrequest.cpp.

◆ setOriginalUrl()

void QgsServerRequest::setOriginalUrl ( const QUrl &  url)
protected

Set the request original url (the request url as seen by the web server)

See also
setUrl() for the rewritten url
Since
QGIS 3.6

Definition at line 96 of file qgsserverrequest.cpp.

◆ setParameter()

void QgsServerRequest::setParameter ( const QString &  key,
const QString &  value 
)
virtual

Set a parameter.

Reimplemented in QgsWms::QgsWmsRequest.

Definition at line 131 of file qgsserverrequest.cpp.

◆ setUrl()

void QgsServerRequest::setUrl ( const QUrl &  url)
virtual

Set the request url.

Reimplemented in QgsWms::QgsWmsRequest.

Definition at line 153 of file qgsserverrequest.cpp.

◆ url()

QUrl QgsServerRequest::url ( ) const
Returns
the request url as seen by QGIS server
See also
originalUrl for the unrewritten url as seen by the web server library, by default the two are equal

Definition at line 86 of file qgsserverrequest.cpp.


The documentation for this class was generated from the following files: