QGIS API Documentation
3.24.2-Tisler (13c1a02865)
|
The QgsServerStaticHandler class serves static files from the static path (resources/server/api/wfs3/static) More...
#include <qgsserverstatichandler.h>
Public Member Functions | |
QgsServerStaticHandler (const QString &pathRegExp=QStringLiteral("/static/(?<staticFilePath>.*)$"), const QString &staticPathSuffix=QString()) | |
Creates QgsServerStaticHandler. More... | |
std::string | description () const override |
Description. More... | |
void | handleRequest (const QgsServerApiContext &context) const override |
Handles the request within its context. More... | |
std::string | linkTitle () const override |
Title for the handler link. More... | |
QgsServerOgcApi::Rel | linkType () const override |
Main role for the resource link. More... | |
std::string | operationId () const override |
Returns the operation id for template file names and other internal references. More... | |
QRegularExpression | path () const override |
URL pattern for this handler, named capture group are automatically extracted and returned by values() More... | |
std::string | summary () const override |
Summary. More... | |
Public Member Functions inherited from QgsServerOgcApiHandler | |
virtual | ~QgsServerOgcApiHandler () |
QString | contentTypeForAccept (const QString &accept) const |
Looks for the first ContentType match in the accept header and returns its mime type, returns an empty string if there are not matches. More... | |
QgsServerOgcApi::ContentType | contentTypeFromRequest (const QgsServerRequest *request) const |
Returns the content type from the request. More... | |
QList< QgsServerOgcApi::ContentType > | contentTypes () const |
Returns the list of content types this handler can serve, default to JSON and HTML. More... | |
virtual QgsServerOgcApi::ContentType | defaultContentType () const |
Returns the default response content type in case the client did not specifically ask for any particular content type. More... | |
std::string | href (const QgsServerApiContext &context, const QString &extraPath=QString(), const QString &extension=QString()) const |
Returns an URL to self, to be used for links to the current resources and as a base for constructing links to sub-resources. More... | |
void | htmlDump (const json &data, const QgsServerApiContext &context) const |
Writes data as HTML to the response stream in context using a template. More... | |
void | jsonDump (json &data, const QgsServerApiContext &context, const QString &contentType=QStringLiteral("application/json")) const |
Writes data to the context response stream as JSON (indented if debug is active), an optional contentType can be specified. More... | |
json | jsonTags () const |
Returns tags as JSON. More... | |
QgsVectorLayer * | layerFromContext (const QgsServerApiContext &context) const |
Returns a vector layer instance from the "collectionId" parameter of the path in the given context, requires a valid project instance in the context. More... | |
json | link (const QgsServerApiContext &context, const QgsServerOgcApi::Rel &linkType=QgsServerOgcApi::Rel::self, const QgsServerOgcApi::ContentType contentType=QgsServerOgcApi::ContentType::JSON, const std::string &title="") const |
Builds and returns a link to the resource. More... | |
json | links (const QgsServerApiContext &context) const |
Returns all the links for the given request context. More... | |
virtual QList< QgsServerQueryStringParameter > | parameters (const QgsServerApiContext &context) const |
Returns a list of query string parameters. More... | |
virtual json | schema (const QgsServerApiContext &context) const |
Returns handler information from the context for the OPENAPI description (id, description and other metadata) as JSON. More... | |
virtual const QString | staticPath (const QgsServerApiContext &context) const |
Returns the absolute path to the base directory where static resources for this handler are stored in the given context. More... | |
virtual QStringList | tags () const |
Tags. More... | |
virtual const QString | templatePath (const QgsServerApiContext &context) const |
Returns the HTML template path for the handler in the given context. More... | |
virtual QVariantMap | values (const QgsServerApiContext &context) const SIP_THROW(QgsServerApiBadRequestException) |
Analyzes the incoming request context and returns the validated parameter map, throws QgsServerApiBadRequestError in case of errors. More... | |
void | write (json &data, const QgsServerApiContext &context, const json &htmlMetadata=nullptr) const |
Writes data to the context response stream, content-type is calculated from the context request, optional htmlMetadata for the HTML templates can be specified and will be added as "metadata" to the HTML template variables. More... | |
void | write (QVariant &data, const QgsServerApiContext &context, const QVariantMap &htmlMetadata=QVariantMap()) const SIP_THROW(QgsServerApiBadRequestException) |
Writes data to the context response stream, content-type is calculated from the context request, optional htmlMetadata for the HTML templates can be specified and will be added as "metadata" to the HTML template variables. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsServerOgcApiHandler | |
static json | defaultResponse () |
Returns the defaultResponse as JSON. More... | |
static QgsVectorLayer * | layerFromCollectionId (const QgsServerApiContext &context, const QString &collectionId) |
Returns a vector layer from the collectionId in the given context. More... | |
static QString | parentLink (const QUrl &url, int levels=1) |
Returns a link to the parent page up to levels in the HTML hierarchy from the given url, MAP query argument is preserved. More... | |
Protected Member Functions inherited from QgsServerOgcApiHandler | |
void | setContentTypes (const QList< QgsServerOgcApi::ContentType > &contentTypes) |
Set the content types to contentTypes. More... | |
void | setContentTypesInt (const QList< int > &contentTypes) |
Set the content types to contentTypes. More... | |
The QgsServerStaticHandler class serves static files from the static path (resources/server/api/wfs3/static)
Definition at line 28 of file qgsserverstatichandler.h.
QgsServerStaticHandler::QgsServerStaticHandler | ( | const QString & | pathRegExp = QStringLiteral( "/static/(?<staticFilePath>.*)$" ) , |
const QString & | staticPathSuffix = QString( ) |
||
) |
Creates QgsServerStaticHandler.
pathRegExp | optional regular expression to capture static file names, defaults to "/static/(?<staticFilePath>.*)$", note that the file path is captured in a named group "staticFilePath" |
staticPathSuffix | optional path suffix to use when static files are stored in a subdirectory of the default staticPath() |
Definition at line 24 of file qgsserverstatichandler.cpp.
|
inlineoverridevirtual |
Description.
Implements QgsServerOgcApiHandler.
Definition at line 47 of file qgsserverstatichandler.h.
|
overridevirtual |
Handles the request within its context.
Subclasses must implement this methods, and call validate() to extract validated parameters from the request.
QgsServerApiBadRequestError | if the method encounters any error |
Reimplemented from QgsServerOgcApiHandler.
Definition at line 31 of file qgsserverstatichandler.cpp.
|
inlineoverridevirtual |
Title for the handler link.
Implements QgsServerOgcApiHandler.
Definition at line 48 of file qgsserverstatichandler.h.
|
inlineoverridevirtual |
Main role for the resource link.
Implements QgsServerOgcApiHandler.
Definition at line 49 of file qgsserverstatichandler.h.
|
inlineoverridevirtual |
Returns the operation id for template file names and other internal references.
Implements QgsServerOgcApiHandler.
Definition at line 45 of file qgsserverstatichandler.h.
|
inlineoverridevirtual |
URL pattern for this handler, named capture group are automatically extracted and returned by values()
Example: "/handlername/(?P<code1>\d{2})/items" will capture "code1" as a named parameter.
Implements QgsServerOgcApiHandler.
Definition at line 44 of file qgsserverstatichandler.h.
|
inlineoverridevirtual |