QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
37 mParams.
load( QUrlQuery(
url ) );
42 , mOriginalUrl( other.mOriginalUrl )
43 , mBaseUrl( other.mBaseUrl )
44 , mMethod( other.mMethod )
45 , mHeaders( other.mHeaders )
46 , mParams( other.mParams )
52 static const QMetaEnum metaEnum = QMetaEnum::fromType<QgsServerRequest::Method>();
53 return QString( metaEnum.valueToKey(
method ) ).remove( QStringLiteral(
"Method" ) ).toUpper( );
58 return mHeaders.value( name );
64 const QString headerKey = QString( qgsEnumValueToKey<QgsServerRequest::RequestHeader>( headerEnum ) );
67 ).replace( QLatin1Char(
' ' ), QLatin1Char(
'-' ) );
68 return header( headerName );
73 mHeaders.insert( name, value );
83 mHeaders.remove( name );
118 return mParams.
toMap();
133 mParams.
add( key, value );
134 mUrl.setQuery( mParams.
urlQuery() );
139 const auto value { mParams.
value( key ) };
140 if ( value.isEmpty() )
150 mUrl.setQuery( mParams.
urlQuery() );
157 mParams.
load( QUrlQuery( mUrl ) );
167 if ( !QUrlQuery( mUrl ).hasQueryItem( name ) )
171 return QUrl::fromPercentEncoding( QUrlQuery( mUrl ).queryItemValue( name ).toUtf8() );
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
static QString capitalize(const QString &string, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
QUrl baseUrl() const
Returns the base URL of QGIS server.
void setHeader(const QString &name, const QString &value)
Set an header.
QMap< QString, QString > toMap() const
Returns all parameters in a map.
void load(const QUrlQuery &query)
Loads new parameters.
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() met...
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
QString value(const QString &key) const
Returns the value of a parameter.
void removeHeader(const QString &name)
Remove an header.
void remove(const QString &key)
Removes a parameter.
virtual void removeParameter(const QString &key)
Remove a parameter.
void setMethod(QgsServerRequest::Method method)
Set the request method.
void setBaseUrl(const QUrl &url)
Set the base URL of QGIS server.
void add(const QString &key, const QString &value)
Adds a parameter.
QgsServerParameters serverParameters() const
Returns parameters.
virtual void setParameter(const QString &key, const QString &value)
Set a parameter.
QgsServerRequest::Method method() const
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()=default
Constructor.
virtual QString header(const QString &name) const
Returns the header value.
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...
virtual QByteArray data() const
Returns post/put data Check for QByteArray::isNull() to check if data is available.
QString parameter(const QString &key, const QString &defaultValue=QString()) const
Gets a parameter value.
RequestHeader
The internal HTTP Header used for the request as enum.
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
Method
HTTP Method (or equivalent) used for the request.
QMap< QString, QString > Headers
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
static QString methodToString(const Method &method)
Returns a string representation of an HTTP request method.
virtual void setUrl(const QUrl &url)
Set the request url.
void clear()
Removes all parameters.
QMap< QString, QString > headers() const
Returns the header map.