QGIS API Documentation  3.2.0-Bonn (bc43194)
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 "qgsconfigparserutils.h"
35 #include "qgscapabilitiescache.h"
36 #include "qgsmapsettings.h"
37 #include "qgsmessagelog.h"
38 #include "qgsserviceregistry.h"
39 #include "qgsserversettings.h"
40 #include "qgsserverplugins.h"
41 #include "qgsserverfilter.h"
42 #include "qgsserverinterfaceimpl.h"
43 #include "qgis_server.h"
44 #include "qgsserverrequest.h"
45 
46 class QgsServerResponse;
47 class QgsProject;
48 
53 class SERVER_EXPORT QgsServer
54 {
55  public:
56 
60  QgsServer();
61 
68  void putenv( const QString &var, const QString &val );
69 
82  void handleRequest( QgsServerRequest &request, QgsServerResponse &response, const QgsProject *project = nullptr );
83 
84 
86  QgsServerInterfaceImpl SIP_PYALTERNATIVETYPE( QgsServerInterface ) *serverInterface() { return sServerInterface; }
87 
88 #ifdef HAVE_SERVER_PYTHON_PLUGINS
89 
94  void initPython();
95 #endif
96 
97  private:
98 #ifdef SIP_RUN
99  QgsServer( const QgsServer & );
100  QgsServer &operator=( const QgsServer & );
101 #endif
102 
104  static bool init();
105 
109  static QString configPath( const QString &defaultConfigPath,
110  const QMap<QString, QString> &parameters );
111 
117  static void printRequestParameters(
118  const QMap< QString, QString> &parameterMap,
119  Qgis::MessageLevel logLevel );
120 
124  static QFileInfo defaultProjectFile();
125  static QFileInfo defaultAdminSLD();
126 
130  static void setupNetworkAccessManager();
131 
133  static QgsRequestHandler *createRequestHandler( const QgsServerRequest &request, QgsServerResponse &response );
134 
135  // Return the server name
136  static QString &serverName();
137 
138  // Status
139  static QString *sConfigFilePath;
140  static QgsCapabilitiesCache *sCapabilitiesCache;
141  static QgsServerInterfaceImpl *sServerInterface;
143  static bool sInitialized;
144 
146  static QgsServiceRegistry *sServiceRegistry;
147 
148  static QgsServerSettings sSettings;
149 
151  QgsConfigCache *mConfigCache = nullptr;
152 };
153 #endif // QGSSERVER_H
QgsServerInterfaceImpl * serverInterface()
Returns a pointer to the server interface.
Definition: qgsserver.h:86
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:78
Reads and writes project states.
Definition: qgsproject.h:85
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:53
A cache for capabilities xml documents (by configuration file path)
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
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