QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsserverapi.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserverapi.h
3 
4  Class defining the service interface for QGIS server APIs.
5  -------------------
6  begin : 2019-04-16
7  copyright : (C) 2019 by Alessandro Pasotti
8  email : elpaso at itopen dot it
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 
21 
22 #ifndef QGSSERVERAPI_H
23 #define QGSSERVERAPI_H
24 
25 #include "qgis_server.h"
26 #include <QRegularExpression>
27 #include "qgsserverexception.h"
28 #include "qgsserverrequest.h"
29 
30 class QgsServerResponse;
31 class QgsProject;
33 class QgsServerInterface;
34 
80 class SERVER_EXPORT QgsServerApi
81 {
82 
83  public:
84 
88  QgsServerApi( QgsServerInterface *serverIface );
89 
90  virtual ~QgsServerApi() = default;
91 
95  virtual const QString name() const = 0;
96 
100  virtual const QString description() const = 0;
101 
106  virtual const QString version() const { return QString(); }
107 
111  virtual const QString rootPath() const = 0;
112 
116  virtual bool allowMethod( QgsServerRequest::Method ) const { return true; }
117 
121  virtual bool accept( const QUrl &url ) const;
122 
126  virtual void executeRequest( const QgsServerApiContext &context ) const = 0;
127 
131  QgsServerInterface *serverIface() const;
132 
133  private:
134 
135  QgsServerInterface *mServerIface = nullptr;
136 };
137 
138 
139 #endif // QGSSERVERAPI_H
140 
141 
Server generic API endpoint abstract base class.
Definition: qgsserverapi.h:80
Method
HTTP Method (or equivalent) used for the request.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
Definition: qgsproject.h:89
The QgsServerApiContext class encapsulates the resources for a particular client request: the request...
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual const QString version() const
Returns the version of the service.
Definition: qgsserverapi.h:106
virtual bool allowMethod(QgsServerRequest::Method) const
Returns true if the given method is supported by the API, default implementation supports all methods...
Definition: qgsserverapi.h:116