QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
The QgsServerApiContext class encapsulates the resources for a particular client request: the request and response objects, the project (might be NULL) and the server interface, the API root path that matched the request is also added. More...
#include <qgsserverapicontext.h>
Public Member Functions | |
QgsServerApiContext (const QString &apiRootPath, const QgsServerRequest *request, QgsServerResponse *response, const QgsProject *project, QgsServerInterface *serverInterface) | |
QgsServerApiContext constructor. More... | |
QString | apiRootPath () const |
Returns the API root path. More... | |
const QString | matchedPath () const |
Returns the initial part of the incoming request URL path that matches the API root path. More... | |
const QgsProject * | project () const |
Returns the (possibly NULL) project. More... | |
const QgsServerRequest * | request () const |
Returns the server request object. More... | |
QgsServerResponse * | response () const |
Returns the server response object. More... | |
QgsServerInterface * | serverInterface () const |
Returns the server interface. More... | |
void | setProject (const QgsProject *project) |
Sets the project to project. More... | |
void | setRequest (const QgsServerRequest *request) |
Sets context request to request. More... | |
The QgsServerApiContext class encapsulates the resources for a particular client request: the request and response objects, the project (might be NULL) and the server interface, the API root path that matched the request is also added.
QgsServerApiContext is lightweight copyable object meant to be passed along the request handlers chain.
Definition at line 38 of file qgsserverapicontext.h.
QgsServerApiContext::QgsServerApiContext | ( | const QString & | apiRootPath, |
const QgsServerRequest * | request, | ||
QgsServerResponse * | response, | ||
const QgsProject * | project, | ||
QgsServerInterface * | serverInterface | ||
) |
QgsServerApiContext constructor.
apiRootPath | is the API root path, this information is used by the handlers to build the href links to the resources and to the HTML templates. |
request | the incoming request |
response | the response |
project | the project (might be NULL) |
serverInterface | the server interface |
Definition at line 23 of file qgsserverapicontext.cpp.
QString QgsServerApiContext::apiRootPath | ( | ) | const |
Returns the API root path.
Definition at line 75 of file qgsserverapicontext.cpp.
const QString QgsServerApiContext::matchedPath | ( | ) | const |
Returns the initial part of the incoming request URL path that matches the API root path.
If there is no match returns an empty string (it should never happen).
I.e. for an API with root path "/wfs3" and an incoming request "https://www.qgis.org/services/wfs3/collections" this method will return "/resources/wfs3"
Definition at line 60 of file qgsserverapicontext.cpp.
const QgsProject * QgsServerApiContext::project | ( | ) | const |
Returns the (possibly NULL) project.
Definition at line 45 of file qgsserverapicontext.cpp.
const QgsServerRequest * QgsServerApiContext::request | ( | ) | const |
Returns the server request object.
Definition at line 33 of file qgsserverapicontext.cpp.
QgsServerResponse * QgsServerApiContext::response | ( | ) | const |
Returns the server response object.
Definition at line 39 of file qgsserverapicontext.cpp.
QgsServerInterface * QgsServerApiContext::serverInterface | ( | ) | const |
Returns the server interface.
Definition at line 55 of file qgsserverapicontext.cpp.
void QgsServerApiContext::setProject | ( | const QgsProject * | project | ) |
Sets the project to project.
Definition at line 50 of file qgsserverapicontext.cpp.
void QgsServerApiContext::setRequest | ( | const QgsServerRequest * | request | ) |
Sets context request to request.
Definition at line 80 of file qgsserverapicontext.cpp.