QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsServerApiContext Class Reference

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 QgsProjectproject () const
 Returns the (possibly NULL) project.
 
const QgsServerRequestrequest () const
 Returns the server request object.
 
QgsServerResponseresponse () const
 Returns the server response object.
 
QgsServerInterfaceserverInterface () 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.
 

Detailed Description

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.

Since
QGIS 3.10

Definition at line 38 of file qgsserverapicontext.h.

Constructor & Destructor Documentation

◆ QgsServerApiContext()

QgsServerApiContext::QgsServerApiContext ( const QString &  apiRootPath,
const QgsServerRequest request,
QgsServerResponse response,
const QgsProject project,
QgsServerInterface serverInterface 
)

QgsServerApiContext constructor.

Parameters
apiRootPathis the API root path, this information is used by the handlers to build the href links to the resources and to the HTML templates.
requestthe incoming request
responsethe response
projectthe project (might be NULL)
serverInterfacethe server interface

Definition at line 23 of file qgsserverapicontext.cpp.

Member Function Documentation

◆ apiRootPath()

QString QgsServerApiContext::apiRootPath ( ) const

Returns the API root path.

Definition at line 75 of file qgsserverapicontext.cpp.

◆ handlerPath()

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.

Since
QGIS 3.22

Definition at line 85 of file qgsserverapicontext.cpp.

◆ matchedPath()

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.

◆ project()

const QgsProject * QgsServerApiContext::project ( ) const

Returns the (possibly NULL) project.

See also
setProject()

Definition at line 45 of file qgsserverapicontext.cpp.

◆ request()

const QgsServerRequest * QgsServerApiContext::request ( ) const

Returns the server request object.

Definition at line 33 of file qgsserverapicontext.cpp.

◆ response()

QgsServerResponse * QgsServerApiContext::response ( ) const

Returns the server response object.

Definition at line 39 of file qgsserverapicontext.cpp.

◆ serverInterface()

QgsServerInterface * QgsServerApiContext::serverInterface ( ) const

Returns the server interface.

Definition at line 55 of file qgsserverapicontext.cpp.

◆ setProject()

void QgsServerApiContext::setProject ( const QgsProject project)

Sets the project to project.

See also
project()

Definition at line 50 of file qgsserverapicontext.cpp.

◆ setRequest()

void QgsServerApiContext::setRequest ( const QgsServerRequest request)

Sets context request to request.

Definition at line 80 of file qgsserverapicontext.cpp.


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