Skip to content
Permalink
Browse files

Wire in capabilities cache class

  • Loading branch information
mhugent committed May 11, 2011
1 parent bf07028 commit a09d04399c9ecde2d057e3c04b7ce1f4d35768c1
Showing with 28 additions and 10 deletions.
  1. +28 −10 src/mapserver/qgis_map_serv.cpp
@@ -18,6 +18,7 @@ map service syntax for SOAP/HTTP POST
***************************************************************************/

#include "qgsapplication.h"
#include "qgscapabilitiescache.h"
#include "qgsconfigcache.h"
#include "qgsgetrequesthandler.h"
#include "qgssoaprequesthandler.h"
@@ -191,6 +192,9 @@ int main( int argc, char * argv[] )
}
}

//create cache for capabilities XML
QgsCapabilitiesCache capabilitiesCache;

//creating QgsMapRenderer is expensive (access to srs.db), so we do it here before the fcgi loop
QgsMapRenderer* theMapRenderer = new QgsMapRenderer();

@@ -291,20 +295,34 @@ int main( int argc, char * argv[] )

if ( requestIt->second == "GetCapabilities" )
{
QDomDocument capabilitiesDocument;
try
const QDomDocument* capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath );
if( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
{
QgsMSDebugMsg( "Capabilities document not found in cache" );
QDomDocument doc;
try
{
doc = theServer->getCapabilities();
}
catch ( QgsMapServiceException& ex )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
}
capabilitiesCache.insertCapabilitiesDocument( configFilePath, &doc );
capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath );
}
else
{
capabilitiesDocument = theServer->getCapabilities();
QgsMSDebugMsg( "Found capabilities document in cache" );
}
catch ( QgsMapServiceException& ex )

if( capabilitiesDocument )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
theRequestHandler->sendGetCapabilitiesResponse( *capabilitiesDocument );
}
QgsMSDebugMsg( "sending GetCapabilities response" );
theRequestHandler->sendGetCapabilitiesResponse( capabilitiesDocument );
delete theRequestHandler;
delete theServer;
continue;

0 comments on commit a09d043

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