QGIS API Documentation  3.0.2-Girona (307d082)
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 
106  // All functions that where previously in the main file are now
107  // static methods of this class
108  static QString configPath( const QString &defaultConfigPath,
109  const QMap<QString, QString> &parameters );
110 
116  static void printRequestParameters(
117  const QMap< QString, QString> &parameterMap,
118  Qgis::MessageLevel logLevel );
119 
120  static QFileInfo defaultProjectFile();
121  static QFileInfo defaultAdminSLD();
122  static void setupNetworkAccessManager();
124  static QgsRequestHandler *createRequestHandler( const QgsServerRequest &request, QgsServerResponse &response );
125 
126  // Return the server name
127  static QString &serverName();
128 
129  // Status
130  static QString *sConfigFilePath;
131  static QgsCapabilitiesCache *sCapabilitiesCache;
132  static QgsServerInterfaceImpl *sServerInterface;
134  static bool sInitialized;
135 
137  static QgsServiceRegistry *sServiceRegistry;
138 
139  static QgsServerSettings sSettings;
140 
142  QgsConfigCache *mConfigCache = nullptr;
143 };
144 #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:82
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