QGIS API Documentation  2.14.0-Essen
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 "qgsmaprenderer.h"
34 #include "qgsconfigcache.h"
35 #include "qgscapabilitiescache.h"
36 
37 #ifdef HAVE_SERVER_PYTHON_PLUGINS
38 #include "qgsserverplugins.h"
39 #include "qgsserverfilter.h"
40 #include "qgsserverinterfaceimpl.h"
41 #endif
42 
43 
47 class SERVER_EXPORT QgsServer
48 {
49  public:
54  QgsServer( int & argc, char ** argv );
56  QgsServer();
57  ~QgsServer();
58 
62  static bool init( int & argc, char ** argv );
64  static bool init();
65 
71  void putenv( const QString &var, const QString &val );
72 
84  QPair<QByteArray, QByteArray> handleRequest( const QString& queryString = QString() );
85 #if 0
86  // The following code was used to test type conversion in python bindings
88 #endif
89 
91 #ifdef HAVE_SERVER_PYTHON_PLUGINS
92  QgsServerInterfaceImpl* serverInterface() { return sServerInterface; }
93 #endif
94 
95  private:
96  // All functions that where previously in the main file are now
97  // static methods of this class
98  static QString configPath( const QString& defaultConfigPath,
99  const QMap<QString, QString>& parameters );
100  // Mainly for debug
101  static void dummyMessageHandler( QtMsgType type, const char *msg );
102  // Mainly for debug
103  static void printRequestInfos();
104  // Mainly for debug
105  static void printRequestParameters(
106  const QMap< QString, QString>& parameterMap,
107  int logLevel );
108  static QFileInfo defaultProjectFile();
109  static QFileInfo defaultAdminSLD();
110  static void setupNetworkAccessManager();
112  static QgsRequestHandler* createRequestHandler( const bool captureOutput = false );
113 
114  // Return the server name
115  static QString &serverName();
116 
117  // Status
118  static QString* sConfigFilePath;
119  static QgsCapabilitiesCache* sCapabilitiesCache;
120  static QgsMapRenderer* sMapRenderer;
121 #ifdef HAVE_SERVER_PYTHON_PLUGINS
122  static QgsServerInterfaceImpl* sServerInterface;
123  static bool sInitPython;
124 #endif
125  static bool sInitialised;
127  static char* sArgv[1];
128  static int sArgc;
129  static QgsApplication* sQgsApplication;
130  static bool sCaptureOutput;
131 };
132 #endif // QGSSERVER_H
133 
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
A non GUI class for rendering a map layer set onto a QPainter.
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:47
A cache for capabilities xml documents (by configuration file path)