Class: QgsServerApiContext

class qgis.server.QgsServerApiContext(apiRootPath: str, request: QgsServerRequest, response: QgsServerResponse, project: QgsProject, serverInterface: QgsServerInterface)

Bases: sip.wrapper

QgsServerApiContext constructor

Parameters
  • 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

QgsServerApiContext(QgsServerApiContext)

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.

New in version 3.10: Enums

Methods

apiRootPath

Returns the API root path

matchedPath

Returns the initial part of the incoming request URL path that matches the API root path.

project

Returns the (possibly NULL) project

request

Returns the server request object

response

Returns the server response object

serverInterface

Returns the server interface

setProject

Sets the project to project

setRequest

Sets context request to request

Signals

Attributes

apiRootPath(self) → str

Returns the API root path

matchedPath(self) → str

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”

project(self) → QgsProject

Returns the (possibly NULL) project

See also

setProject()

request(self) → QgsServerRequest

Returns the server request object

response(self) → QgsServerResponse

Returns the server response object

serverInterface(self) → QgsServerInterface

Returns the server interface

setProject(self, project: QgsProject)

Sets the project to project

See also

project()

setRequest(self, request: QgsServerRequest)

Sets context request to request