QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
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. | |
std::string | description () const override |
Description. | |
void | handleRequest (const QgsServerApiContext &context) const override |
Handles the request within its context. | |
std::string | linkTitle () const override |
Title for the handler link. | |
QgsServerOgcApi::Rel | linkType () const override |
Main role for the resource link. | |
std::string | operationId () const override |
Returns the operation id for template file names and other internal references. | |
QRegularExpression | path () const override |
URL pattern for this handler, named capture group are automatically extracted and returned by values() | |
std::string | summary () const override |
Summary. | |
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. | |
QgsServerOgcApi::ContentType | contentTypeFromRequest (const QgsServerRequest *request) const |
Returns the content type from the request. | |
QList< QgsServerOgcApi::ContentType > | contentTypes () const |
Returns the list of content types this handler can serve, default to JSON and HTML. | |
virtual QgsServerOgcApi::ContentType | defaultContentType () const |
Returns the default response content type in case the client did not specifically ask for any particular content type. | |
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. | |
void | htmlDump (const json &data, const QgsServerApiContext &context) const |
Writes data as HTML to the response stream in context using a template. | |
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. | |
json | jsonTags () const |
Returns tags as JSON. | |
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. | |
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. | |
json | links (const QgsServerApiContext &context) const |
Returns all the links for the given request context. | |
virtual QList< QgsServerQueryStringParameter > | parameters (const QgsServerApiContext &context) const |
Returns a list of query string parameters. | |
virtual json | schema (const QgsServerApiContext &context) const |
Returns handler information from the context for the OPENAPI description (id, description and other metadata) as JSON. | |
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. | |
virtual QStringList | tags () const |
Tags. | |
virtual const QString | templatePath (const QgsServerApiContext &context) const |
Returns the HTML template path for the handler in the given context. | |
virtual QVariantMap | values (const QgsServerApiContext &context) const |
Analyzes the incoming request context and returns the validated parameter map, throws QgsServerApiBadRequestError in case of errors. | |
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. | |
void | write (QVariant &data, const QgsServerApiContext &context, const QVariantMap &htmlMetadata=QVariantMap()) 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. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsServerOgcApiHandler | |
static json | defaultResponse () |
Returns the defaultResponse as JSON. | |
static QgsVectorLayer * | layerFromCollectionId (const QgsServerApiContext &context, const QString &collectionId) |
Returns a vector layer from the collectionId in the given context. | |
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. | |
Protected Member Functions inherited from QgsServerOgcApiHandler | |
void | setContentTypes (const QList< QgsServerOgcApi::ContentType > &contentTypes) |
Set the content types to contentTypes. | |
void | setContentTypesInt (const QList< int > &contentTypes) |
Set the content types to contentTypes. | |
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 |