QGIS API Documentation 3.41.0-Master (3c143d501a8)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsRequestHandler Class Reference

This class is an interface hiding the details of reading input and writing output from/to a wms request mechanism. More...

#include <qgsrequesthandler.h>

Public Member Functions

 QgsRequestHandler (QgsServerRequest &request, QgsServerResponse &response)
 Constructor.
 
void appendBody (const QByteArray &body)
 Sets the info format string such as "text/xml".
 
QByteArray body () const
 Returns the response body data.
 
void clear ()
 Clears the response body and headers.
 
void clearBody ()
 Clear response buffer.
 
QByteArray data () const
 Returns the request POST data (can be null)
 
bool exceptionRaised () const
 Pointer to last raised exception.
 
QString format () const
 Returns the requested format string.
 
bool headersSent () const
 Returns true if the HTTP headers were already sent to the client.
 
QString parameter (const QString &key) const
 Returns a request parameter.
 
QMap< QString, QString > parameterMap () const
 Returns the parsed parameters as a key-value pair, to modify a parameter setParameter( const QString &key, const QString &value) and removeParameter(const QString &key) must be used.
 
void parseInput ()
 Parses the input and creates a request neutral Parameter/Value map.
 
QString path () const
 Returns the path component of the request URL.
 
void removeParameter (const QString &key)
 Remove a request parameter.
 
void removeRequestHeader (const QString &name)
 Remove an HTTP request header.
 
void removeResponseHeader (const QString &name)
 Remove an HTTP response header.
 
QString requestHeader (const QString &name) const
 Retrieve request header value.
 
QMap< QString, QString > requestHeaders () const
 Returns the the Request headers.
 
QString responseHeader (const QString &name) const
 Retrieve response header value.
 
QMap< QString, QString > responseHeaders () const
 Returns the response headers.
 
void sendResponse ()
 Send out HTTP headers and flush output buffer.
 
void setParameter (const QString &key, const QString &value)
 Sets a request parameter.
 
void setRequestHeader (const QString &name, const QString &value)
 Sets an HTTP request header.
 
void setResponseHeader (const QString &name, const QString &value)
 Sets an HTTP response header.
 
void setServiceException (const QgsServerException &ex)
 Allow plugins to return a QgsMapServiceException.
 
void setStatusCode (int code)
 Sets response http status code.
 
int statusCode () const
 Returns the response http status code.
 
QString url () const
 Returns the request url.
 

Detailed Description

This class is an interface hiding the details of reading input and writing output from/to a wms request mechanism.

Definition at line 38 of file qgsrequesthandler.h.

Constructor & Destructor Documentation

◆ QgsRequestHandler()

QgsRequestHandler::QgsRequestHandler ( QgsServerRequest request,
QgsServerResponse response 
)
explicit

Constructor.

Note that QgsServerRequest and QgsServerResponse MUST live in the same scope

Definition at line 30 of file qgsrequesthandler.cpp.

Member Function Documentation

◆ appendBody()

void QgsRequestHandler::appendBody ( const QByteArray &  body)

Sets the info format string such as "text/xml".

Definition at line 99 of file qgsrequesthandler.cpp.

◆ body()

QByteArray QgsRequestHandler::body ( ) const

Returns the response body data.

Definition at line 109 of file qgsrequesthandler.cpp.

◆ clear()

void QgsRequestHandler::clear ( )

Clears the response body and headers.

Definition at line 52 of file qgsrequesthandler.cpp.

◆ clearBody()

void QgsRequestHandler::clearBody ( )

Clear response buffer.

Definition at line 104 of file qgsrequesthandler.cpp.

◆ data()

QByteArray QgsRequestHandler::data ( ) const

Returns the request POST data (can be null)

Definition at line 114 of file qgsrequesthandler.cpp.

◆ exceptionRaised()

bool QgsRequestHandler::exceptionRaised ( ) const

Pointer to last raised exception.

Definition at line 42 of file qgsrequesthandler.cpp.

◆ format()

QString QgsRequestHandler::format ( ) const
inline

Returns the requested format string.

Definition at line 140 of file qgsrequesthandler.h.

◆ headersSent()

bool QgsRequestHandler::headersSent ( ) const

Returns true if the HTTP headers were already sent to the client.

Definition at line 94 of file qgsrequesthandler.cpp.

◆ parameter()

QString QgsRequestHandler::parameter ( const QString &  key) const

Returns a request parameter.

Definition at line 282 of file qgsrequesthandler.cpp.

◆ parameterMap()

QMap< QString, QString > QgsRequestHandler::parameterMap ( ) const

Returns the parsed parameters as a key-value pair, to modify a parameter setParameter( const QString &key, const QString &value) and removeParameter(const QString &key) must be used.

Definition at line 37 of file qgsrequesthandler.cpp.

◆ parseInput()

void QgsRequestHandler::parseInput ( )

Parses the input and creates a request neutral Parameter/Value map.

Note
not available in Python bindings

Definition at line 193 of file qgsrequesthandler.cpp.

◆ path()

QString QgsRequestHandler::path ( ) const

Returns the path component of the request URL.

Since
QGIS 3.16

Definition at line 124 of file qgsrequesthandler.cpp.

◆ removeParameter()

void QgsRequestHandler::removeParameter ( const QString &  key)

Remove a request parameter.

Definition at line 287 of file qgsrequesthandler.cpp.

◆ removeRequestHeader()

void QgsRequestHandler::removeRequestHeader ( const QString &  name)

Remove an HTTP request header.

Definition at line 77 of file qgsrequesthandler.cpp.

◆ removeResponseHeader()

void QgsRequestHandler::removeResponseHeader ( const QString &  name)

Remove an HTTP response header.

Definition at line 57 of file qgsrequesthandler.cpp.

◆ requestHeader()

QString QgsRequestHandler::requestHeader ( const QString &  name) const

Retrieve request header value.

Definition at line 82 of file qgsrequesthandler.cpp.

◆ requestHeaders()

QMap< QString, QString > QgsRequestHandler::requestHeaders ( ) const

Returns the the Request headers.

Definition at line 88 of file qgsrequesthandler.cpp.

◆ responseHeader()

QString QgsRequestHandler::responseHeader ( const QString &  name) const

Retrieve response header value.

Definition at line 62 of file qgsrequesthandler.cpp.

◆ responseHeaders()

QMap< QString, QString > QgsRequestHandler::responseHeaders ( ) const

Returns the response headers.

Definition at line 67 of file qgsrequesthandler.cpp.

◆ sendResponse()

void QgsRequestHandler::sendResponse ( )

Send out HTTP headers and flush output buffer.

This method is intended only for streaming partial content.

Definition at line 139 of file qgsrequesthandler.cpp.

◆ setParameter()

void QgsRequestHandler::setParameter ( const QString &  key,
const QString &  value 
)

Sets a request parameter.

Definition at line 266 of file qgsrequesthandler.cpp.

◆ setRequestHeader()

void QgsRequestHandler::setRequestHeader ( const QString &  name,
const QString &  value 
)

Sets an HTTP request header.

Definition at line 72 of file qgsrequesthandler.cpp.

◆ setResponseHeader()

void QgsRequestHandler::setResponseHeader ( const QString &  name,
const QString &  value 
)

Sets an HTTP response header.

Definition at line 47 of file qgsrequesthandler.cpp.

◆ setServiceException()

void QgsRequestHandler::setServiceException ( const QgsServerException ex)

Allow plugins to return a QgsMapServiceException.

Definition at line 145 of file qgsrequesthandler.cpp.

◆ setStatusCode()

void QgsRequestHandler::setStatusCode ( int  code)

Sets response http status code.

Definition at line 129 of file qgsrequesthandler.cpp.

◆ statusCode()

int QgsRequestHandler::statusCode ( ) const

Returns the response http status code.

Definition at line 134 of file qgsrequesthandler.cpp.

◆ url()

QString QgsRequestHandler::url ( ) const

Returns the request url.

Definition at line 119 of file qgsrequesthandler.cpp.


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