35 , mRequestHeaderConv()
37 mRequestHeaderConv.insert(
HOST, QStringLiteral(
"Host" ) );
38 mRequestHeaderConv.insert(
FORWARDED, QStringLiteral(
"Forwarded" ) );
39 mRequestHeaderConv.insert(
X_FORWARDED_FOR, QStringLiteral(
"X-Forwarded-For" ) );
40 mRequestHeaderConv.insert(
X_FORWARDED_HOST, QStringLiteral(
"X-Forwarded-Host" ) );
41 mRequestHeaderConv.insert(
X_FORWARDED_PROTO, QStringLiteral(
"X-Forwarded-Proto" ) );
42 mRequestHeaderConv.insert(
X_QGIS_SERVICE_URL, QStringLiteral(
"X-Qgis-Service-Url" ) );
48 mParams.
load( QUrlQuery(
url ) );
53 , mOriginalUrl( other.mOriginalUrl )
54 , mBaseUrl( other.mBaseUrl )
55 , mMethod( other.mMethod )
56 , mHeaders( other.mHeaders )
57 , mParams( other.mParams )
58 , mRequestHeaderConv( other.mRequestHeaderConv )
64 static QMetaEnum metaEnum = QMetaEnum::fromType<QgsServerRequest::Method>();
65 return QString( metaEnum.valueToKey(
method ) ).remove( QStringLiteral(
"Method" ) ).toUpper( );
70 return mHeaders.value( name );
76 return header( mRequestHeaderConv[ headerEnum ] );
81 mHeaders.insert( name, value );
91 mHeaders.remove( name );
126 return mParams.
toMap();
141 mParams.
add( key, value );
142 mUrl.setQuery( mParams.
urlQuery() );
147 const auto value { mParams.
value( key ) };
148 if ( value.isEmpty() )
158 mUrl.setQuery( mParams.
urlQuery() );
165 mParams.
load( QUrlQuery( mUrl ) );
175 if ( !QUrlQuery( mUrl ).hasQueryItem( name ) )
179 return QUrl::fromPercentEncoding( QUrlQuery( mUrl ).queryItemValue( name ).toUtf8() );
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
QMap< QString, QString > toMap() const
Returns all parameters in a map.
void add(const QString &key, const QString &value)
Adds a parameter.
void clear()
Removes all parameters.
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
void load(const QUrlQuery &query)
Loads new parameters.
void remove(const QString &key)
Removes a parameter.
QString value(const QString &key) const
Returns the value of a parameter.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
void setOriginalUrl(const QUrl &url)
Set the request original url (the request url as seen by the web server)
Method
HTTP Method (or equivalent) used for the request.
QgsServerParameters serverParameters() const
Returns parameters.
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 sp...
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
virtual QString header(const QString &name) const
Returns the header value.
QString parameter(const QString &key, const QString &defaultValue=QString()) const
Gets a parameter value.
virtual void setParameter(const QString &key, const QString &value)
Set a parameter.
QgsServerRequest()=default
Constructor.
virtual void setUrl(const QUrl &url)
Set the request url.
QMap< QString, QString > headers() const
Returns the header map.
QUrl baseUrl() const
Returns the base URL of QGIS server.
QgsServerRequest::Method method() const
QUrl originalUrl() const
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS s...
void setMethod(QgsServerRequest::Method method)
Set the request method.
void removeHeader(const QString &name)
Remove an header.
QMap< QString, QString > Headers
virtual void removeParameter(const QString &key)
Remove a parameter.
void setBaseUrl(const QUrl &url)
Set the base URL of QGIS server.
void setHeader(const QString &name, const QString &value)
Set an header.
RequestHeader
The internal HTTP Header used for the request as enum.
@ X_QGIS_WMTS_SERVICE_URL
static QString methodToString(const Method &method)
Returns a string representation of an HTTP request method.
virtual QByteArray data() const
Returns post/put data Check for QByteArray::isNull() to check if data is available.