Skip to content
Permalink
Browse files

Merge pull request #2206 from elpaso/server-docs-server-iface-fix

[SERVER] Server docs and server iface fix
  • Loading branch information
elpaso committed Jul 10, 2015
2 parents 2b5ea36 + 0312dbf commit d7d59772a90e6a16ea785fd6ca38d7c549efa263
@@ -22,3 +22,6 @@ high level tools for carrying out spatial analysis on vector and raster data.

The network analysis library provides high level tool for build topology and analysis it.
*/


/** @defgroup server QGIS Server library.*/
@@ -61,7 +61,7 @@ class QgsRequestHandler
/**Remove a request parameter*/
virtual int removeParameter( const QString &key ) = 0;
/**Return a request parameter*/
virtual QString parameter( const QString &key ) const = 0;
virtual QString parameter( const QString &key) const = 0;
/**Return the requested format string*/
QString format() const;
/**Return the mime type for the response*/
@@ -37,8 +37,13 @@ class QDomDocument;
class QImage;
class QgsMapServiceException;

/** This class is an interface hiding the details of reading input and writing output from/to a wms request mechanism.
Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage as a standalone command line executable*/
/**
* \ingroup server
* This class is an interface hiding the details of reading input and writing
* output from/to a wms request mechanism.
* Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage
* as a standalone command line executable
*/
class QgsRequestHandler
{

@@ -590,6 +590,9 @@ QByteArray QgsServer::handleRequest( const QString queryString ,
{
filtersIterator.value()->responseComplete();
}
// We are done using theRequestHandler in plugins, make sure we don't access
// to a deleted request handler from Python bindings
mServerInterface->clearRequestHandler( );
#endif

theRequestHandler->sendResponse();
@@ -41,24 +41,26 @@
#endif


/**
/** \ingroup server
* The QgsServer class provides OGC web services.
*/
class SERVER_EXPORT QgsServer
class SERVER_EXPORT QgsServer
{
public:
QgsServer();
~QgsServer();
/** Server initialisation: intialise QGIS ang QT core application.
* This method is automatically called by handleRequest if it wasn't
* explicitly called before */
* explicitly called before
* @note Not available in Python bindings
*/
static bool init( int & argc, char ** argv );
//! The following is mainly for python bindings, that do not pass argc/argv
static bool init();

/** Handle the request. The output is normally printed trough FCGI printf
/** Handles the request. The output is normally printed trough FCGI printf
* by the request handler or, in case the server has been invoked from python
* bindings, a flag is set that capures all the output headers and body, instead
* bindings, a flag is set that captures all the output headers and body, instead
* of printing it returns the output as a QByteArray.
* When calling handleRequest() from python bindings an additional argument
* specify if we only want the headers or the body back, this is mainly useful
@@ -25,6 +25,7 @@
class QgsServerInterface;

/**
* \ingroup server
* \class QgsServerFilter
* \brief Class defining I/O filters for QGIS Server and
* implemented in plugins.
@@ -21,8 +21,6 @@
QgsServerInterface::QgsServerInterface():
mConfigFilePath( QString() )
{


}

QgsServerInterface::~QgsServerInterface()
@@ -25,6 +25,7 @@
#include "qgsserverfilter.h"

/**
* \ingroup server
* QgsServerInterface
* Class defining interfaces exposed by QGIS Server and
* made available to plugins.
@@ -47,6 +48,13 @@ class SERVER_EXPORT QgsServerInterface
*/
virtual void setRequestHandler( QgsRequestHandler* requestHandler ) = 0;

/**
* Clear the request handler
*
* @note not available in python bindings
*/
virtual void clearRequestHandler( ) = 0;

/**
* Get pointer to the capabiblities cache
* @return QgsCapabilitiesCache
@@ -38,6 +38,12 @@ QgsServerInterfaceImpl::~QgsServerInterfaceImpl()
{
}


void QgsServerInterfaceImpl::clearRequestHandler( )
{
mRequestHandler = NULL;
}

void QgsServerInterfaceImpl::setRequestHandler( QgsRequestHandler * requestHandler )
{
mRequestHandler = requestHandler;
@@ -45,7 +45,9 @@ class QgsServerInterfaceImpl : public QgsServerInterface
~QgsServerInterfaceImpl();

void setRequestHandler( QgsRequestHandler* requestHandler ) override;
void clearRequestHandler( ) override;
QgsCapabilitiesCache* capabiblitiesCache() override { return mCapabilitiesCache; }
//! Return the QgsRequestHandler, to be used only in server plugins
QgsRequestHandler* requestHandler( ) override { return mRequestHandler; }
void registerFilter( QgsServerFilter *filter, int priority = 0 ) override;
QgsServerFiltersMap filters( ) override { return mFilters; }
@@ -24,15 +24,18 @@
// This is needed by SIP otherwise it doesn't find QgsPythonUtils header
class QgsPythonUtils;

/**
* @brief Init Python server plugins and store a list of server plugin names
*/
class SERVER_EXPORT QgsServerPlugins
{
public:
explicit QgsServerPlugins();
/**
* Initialise the python plugins
* @param interface QgsServerInterface
* @return bool true on success
*/
* Initialise the python plugins
* @param interface QgsServerInterface
* @return bool true on success
*/
static bool initPlugins( QgsServerInterface* interface );
//! Pointer to QgsPythonUtils
static QgsPythonUtils* mPythonUtils;
@@ -104,7 +104,8 @@ def responseComplete(self):
## WMS tests
def wms_request_compare(self, request):
map = self.testdata_path + "testproject.qgs"
response = str(self.server.handleRequest('MAP=%s&SERVICE=WMS&VERSION=1.3&REQUEST=%s' % (map, request)))
query_string = 'MAP=%s&SERVICE=WMS&VERSION=1.3&REQUEST=%s' % (map, request)
response = str(self.server.handleRequest(query_string))
f = open(self.testdata_path + request.lower() + '.txt')
expected = f.read()
f.close()

0 comments on commit d7d5977

Please sign in to comment.
You can’t perform that action at this time.