QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 "qgsapplication.h"
33 #include "qgsconfigcache.h"
34 #include "qgscapabilitiescache.h"
35 #include "qgsmapsettings.h"
36 #include "qgsmessagelog.h"
37 #include "qgsserviceregistry.h"
38 #include "qgsserversettings.h"
39 #include "qgsserverplugins.h"
40 #include "qgsserverfilter.h"
41 #include "qgsserverinterfaceimpl.h"
42 #include "qgis_server.h"
43 #include "qgsserverrequest.h"
44 
45 class QgsServerResponse;
46 class QgsProject;
47 
52 class SERVER_EXPORT QgsServer
53 {
54  public:
55 
59  QgsServer();
60 
67  void putenv( const QString &var, const QString &val );
68 
81  void handleRequest( QgsServerRequest &request, QgsServerResponse &response, const QgsProject *project = nullptr );
82 
83 
86 
87 #ifdef HAVE_SERVER_PYTHON_PLUGINS
88 
93  void initPython();
94 #endif
95 
96  private:
97 #ifdef SIP_RUN
98  QgsServer( const QgsServer & );
99  QgsServer &operator=( const QgsServer & );
100 #endif
101 
103  static bool init();
104 
108  static QString configPath( const QString &defaultConfigPath,
109  const QString &configPath );
110 
116  static void printRequestParameters(
117  const QMap< QString, QString> &parameterMap,
118  Qgis::MessageLevel logLevel );
119 
123  static QFileInfo defaultProjectFile();
124  static QFileInfo defaultAdminSLD();
125 
129  static void setupNetworkAccessManager();
130 
132  static QgsRequestHandler *createRequestHandler( const QgsServerRequest &request, QgsServerResponse &response );
133 
134  // Return the server name
135  static QString &serverName();
136 
137  // Status
138  static QString *sConfigFilePath;
139  static QgsCapabilitiesCache *sCapabilitiesCache;
140  static QgsServerInterfaceImpl *sServerInterface;
142  static bool sInitialized;
143 
145  static QgsServiceRegistry *sServiceRegistry;
146 
147  static QgsServerSettings sSettings;
148 
150  QgsConfigCache *mConfigCache = nullptr;
151 
153  static void initLocale();
154 };
155 #endif // QGSSERVER_H
QgsServerInterfaceImpl * serverInterface()
Returns a pointer to the server interface.
Definition: qgsserver.h:85
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:79
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:52
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