QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsserverinterfaceimpl.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsseerversinterface.h
3 Interface class for exposing functions in QGIS Server for use by plugins
4 -------------------
5 begin : 2014-09-10
6 copyright : (C) 2014 by Alessandro Pasotti
7 email : a dot pasotti at itopen dot it
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19
21
22#include "qgsconfigcache.h"
23
26 : mCapabilitiesCache( capCache )
27 , mServiceRegistry( srvRegistry )
28 , mServerSettings( settings )
29{
30 mRequestHandler = nullptr;
31#ifdef HAVE_SERVER_PYTHON_PLUGINS
32 mAccessControls = new QgsAccessControl();
33 mCacheManager = new QgsServerCacheManager( *settings );
34#endif
35}
36
37QString QgsServerInterfaceImpl::getEnv( const QString &name ) const
38{
39 return getenv( name.toLocal8Bit() );
40}
41
42
44{
45#ifdef HAVE_SERVER_PYTHON_PLUGINS
46 delete mAccessControls;
47 delete mCacheManager;
48#endif
49}
50
51
53{
54 mRequestHandler = nullptr;
55}
56
61
63{
64 mConfigFilePath = configFilePath;
65}
66
68{
69 mFilters.insert( priority, filter );
70}
71
76
79{
80#ifdef HAVE_SERVER_PYTHON_PLUGINS
81 mAccessControls->registerAccessControl( accessControl, priority );
82#else
83 Q_UNUSED( accessControl )
84 Q_UNUSED( priority )
85#endif
86}
87
90{
91#ifdef HAVE_SERVER_PYTHON_PLUGINS
92 mCacheManager->registerServerCache( serverCache, priority );
93#else
94 Q_UNUSED( serverCache )
95 Q_UNUSED( priority )
96#endif
97}
98
100{
101 return mCacheManager;
102}
103
105{
106 if ( mCapabilitiesCache )
107 {
108 mCapabilitiesCache->removeCapabilitiesDocument( path );
109 }
111}
112
114{
115 return mServiceRegistry;
116}
117
119{
120 return mServerSettings;
121}
122
124{
125 mServerSettings->load();
126}
Defines access control interface for QGIS Server plugins.
A helper class that centralizes restrictions given by all the access control filter plugins.
A cache for capabilities xml documents (by configuration file path).
void removeEntry(const QString &path)
Removes an entry from cache.
static QgsConfigCache * instance()
Returns the current instance.
An interface hiding the details of reading input and writing output from/to a wms request mechanism.
Defines cache interface for QGIS Server plugins.
A helper class that centralizes caches accesses given by all the server cache filter plugins.
Defines I/O filters for QGIS Server and implemented in plugins.
void registerServerCache(QgsServerCacheFilter *serverCache, int priority=0) override
Registers a server cache filter.
QgsServerSettings * serverSettings() override
Returns the server settings.
void removeConfigCacheEntry(const QString &path) override
Remove entry from config cache.
QgsServerInterfaceImpl(QgsCapabilitiesCache *capCache, QgsServiceRegistry *srvRegistry, QgsServerSettings *serverSettings)
Constructor.
void reloadSettings() override
Reloads the server settings re-reading the configuration.
void setRequestHandler(QgsRequestHandler *requestHandler) override
Set the request handler.
QString getEnv(const QString &name) const override
Returns an enrironment variable, used to pass environment variables to Python.
QgsRequestHandler * requestHandler() override
Returns the QgsRequestHandler, to be used only in server plugins.
void clearRequestHandler() override
Clear the request handler.
QgsServerFiltersMap filters() override
Returns the list of current QgsServerFilter.
QgsServiceRegistry * serviceRegistry() override
Returns the service registry.
void registerAccessControl(QgsAccessControlFilter *accessControl, int priority=0) override
Register an access control filter.
QgsServerCacheManager * cacheManager() const override
Gets the helper over all the registered server cache filters.
void setFilters(QgsServerFiltersMap *filters) override
Set the filters map.
QString configFilePath() override
Returns the configuration file path.
void setConfigFilePath(const QString &configFilePath) override
Set the configuration file path.
void registerFilter(QgsServerFilter *filter, int priority=0) override
Register a QgsServerFilter.
Provides a way to retrieve settings by prioritizing according to environment variables,...
void load()
Load settings according to current environment variables.
A registry manager for QGIS server services.
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap