QGIS API Documentation  3.6.0-Noosa (5873452)
qgsserver.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserver.h
3  QGIS Server main class.
4  -------------------
5  begin : June 05, 2015
6  copyright : (C) 2015 by Alessandro Pasotti
7  email : a dot pasotti at itopen dot it
8 
9  Based on previous work from:
10 
11  begin : July 04, 2006
12  copyright : (C) 2006 by Marco Hugentobler & Ionut Iosifescu Enescu
13  email : marco dot hugentobler at karto dot baug dot ethz dot ch
14 
15  ***************************************************************************/
16 
17 /***************************************************************************
18  * *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or *
22  * (at your option) any later version. *
23  * *
24  ***************************************************************************/
25 
26 
27 #ifndef QGSSERVER_H
28 #define QGSSERVER_H
29 
30 #include <QFileInfo>
31 #include "qgsrequesthandler.h"
32 #include "qgsconfigcache.h"
33 #include "qgscapabilitiescache.h"
34 #include "qgsserviceregistry.h"
35 #include "qgsserversettings.h"
36 #include "qgsserverplugins.h"
37 #include "qgsserverinterfaceimpl.h"
38 #include "qgis_server.h"
39 #include "qgsserverrequest.h"
40 
41 class QgsServerResponse;
42 class QgsProject;
43 
48 class SERVER_EXPORT QgsServer
49 {
50  public:
51 
55  QgsServer();
56 
63  void putenv( const QString &var, const QString &val );
64 
77  void handleRequest( QgsServerRequest &request, QgsServerResponse &response, const QgsProject *project = nullptr );
78 
79 
82 
83 #ifdef HAVE_SERVER_PYTHON_PLUGINS
84 
89  void initPython();
90 #endif
91 
92  private:
93 #ifdef SIP_RUN
94  QgsServer( const QgsServer & );
95  QgsServer &operator=( const QgsServer & );
96 #endif
97 
99  static bool init();
100 
104  static QString configPath( const QString &defaultConfigPath,
105  const QString &configPath );
106 
112  static void printRequestParameters(
113  const QMap< QString, QString> &parameterMap,
114  Qgis::MessageLevel logLevel );
115 
119  static QFileInfo defaultProjectFile();
120  static QFileInfo defaultAdminSLD();
121 
125  static void setupNetworkAccessManager();
126 
128  static QgsRequestHandler *createRequestHandler( const QgsServerRequest &request, QgsServerResponse &response );
129 
130  // Return the server name
131  static QString &serverName();
132 
133  // Status
134  static QString *sConfigFilePath;
135  static QgsCapabilitiesCache *sCapabilitiesCache;
136  static QgsServerInterfaceImpl *sServerInterface;
138  static bool sInitialized;
139 
141  static QgsServiceRegistry *sServiceRegistry;
142 
143  static QgsServerSettings sSettings;
144 
146  QgsConfigCache *mConfigCache = nullptr;
147 };
148 #endif // QGSSERVER_H
QgsServerInterfaceImpl * serverInterface()
Returns a pointer to the server interface.
Definition: qgsserver.h:81
Provides a way to retrieve settings by prioritizing according to environment variables, ini file and default values.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:66
Interfaces exposed by QGIS Server and made available to plugins.
Reads and writes project states.
Definition: qgsproject.h:89
This class is an interface hiding the details of reading input and writing output from/to a wms reque...
The QgsServer class provides OGC web services.
Definition: qgsserver.h:48
A cache for capabilities xml documents (by configuration file path)
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
Cache for server configuration.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QgsServiceRegistry Class defining the registry manager for QGIS server services.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
#define SIP_PYALTERNATIVETYPE(type)
Definition: qgis_sip.h:129