Skip to content
Permalink
Browse files

Clear the request handler when done

also added some comments and docs strings
  • Loading branch information
elpaso committed Jul 10, 2015
1 parent 368eaa2 commit c126592272873c4901808d1c96b19c073879ba9f
@@ -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*/
@@ -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();
@@ -21,8 +21,6 @@
QgsServerInterface::QgsServerInterface():
mConfigFilePath( QString() )
{


}

QgsServerInterface::~QgsServerInterface()
@@ -47,6 +47,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; }
@@ -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 c126592

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