QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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. | |
QString | apiRootPath () const |
Returns the API root path. | |
QString | handlerPath () const |
Returns the handler component of the URL path, i.e. | |
const QString | matchedPath () const |
Returns the initial part of the incoming request URL path that matches the API root path. | |
const QgsProject * | project () const |
Returns the (possibly NULL) project. | |
const QgsServerRequest * | request () const |
Returns the server request object. | |
QgsServerResponse * | response () const |
Returns the server response object. | |
QgsServerInterface * | serverInterface () const |
Returns the server interface. | |
void | setProject (const QgsProject *project) |
Sets the project to project. | |
void | setRequest (const QgsServerRequest *request) |
Sets context request to request. | |
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.
QString QgsServerApiContext::handlerPath | ( | ) | const |
Returns the handler component of the URL path, i.e.
the part of the path that comes after the API path.
Definition at line 85 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.