@@ -416,6 +416,11 @@ bool QgsServer::init( int & argc, char ** argv )
416
416
defaultConfigFilePath = adminSLDFileInfo.absoluteFilePath ();
417
417
}
418
418
}
419
+ if ( !defaultConfigFilePath.isEmpty () )
420
+ {
421
+ mConfigFilePath = defaultConfigFilePath;
422
+ }
423
+
419
424
// create cache for capabilities XML
420
425
mCapabilitiesCache = new QgsCapabilitiesCache ();
421
426
mMapRenderer = new QgsMapRenderer;
@@ -524,9 +529,9 @@ QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString queryStrin
524
529
printRequestParameters ( parameterMap, logLevel );
525
530
QMap<QString, QString>::const_iterator paramIt;
526
531
// Config file path
527
- mConfigFilePath = configPath ( mConfigFilePath , parameterMap );
532
+ QString configFilePath = configPath ( mConfigFilePath , parameterMap );
528
533
#ifdef HAVE_SERVER_PYTHON_PLUGINS
529
- mServerInterface ->setConfigFilePath ( mConfigFilePath );
534
+ mServerInterface ->setConfigFilePath ( configFilePath );
530
535
#endif
531
536
// Service parameter
532
537
QString serviceString = theRequestHandler->parameter ( " SERVICE" );
@@ -554,40 +559,40 @@ QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString queryStrin
554
559
{
555
560
if ( serviceString == " WCS" )
556
561
{
557
- QgsWCSProjectParser* p = QgsConfigCache::instance ()->wcsConfiguration ( mConfigFilePath );
562
+ QgsWCSProjectParser* p = QgsConfigCache::instance ()->wcsConfiguration ( configFilePath );
558
563
if ( !p )
559
564
{
560
565
theRequestHandler->setServiceException ( QgsMapServiceException ( " Project file error" , " Error reading the project file" ) );
561
566
}
562
567
else
563
568
{
564
- QgsWCSServer wcsServer ( mConfigFilePath , parameterMap, p, theRequestHandler.data () );
569
+ QgsWCSServer wcsServer ( configFilePath , parameterMap, p, theRequestHandler.data () );
565
570
wcsServer.executeRequest ();
566
571
}
567
572
}
568
573
else if ( serviceString == " WFS" )
569
574
{
570
- QgsWFSProjectParser* p = QgsConfigCache::instance ()->wfsConfiguration ( mConfigFilePath );
575
+ QgsWFSProjectParser* p = QgsConfigCache::instance ()->wfsConfiguration ( configFilePath );
571
576
if ( !p )
572
577
{
573
578
theRequestHandler->setServiceException ( QgsMapServiceException ( " Project file error" , " Error reading the project file" ) );
574
579
}
575
580
else
576
581
{
577
- QgsWFSServer wfsServer ( mConfigFilePath , parameterMap, p, theRequestHandler.data () );
582
+ QgsWFSServer wfsServer ( configFilePath , parameterMap, p, theRequestHandler.data () );
578
583
wfsServer.executeRequest ();
579
584
}
580
585
}
581
586
else if ( serviceString == " WMS" )
582
587
{
583
- QgsWMSConfigParser* p = QgsConfigCache::instance ()->wmsConfiguration ( mConfigFilePath , parameterMap );
588
+ QgsWMSConfigParser* p = QgsConfigCache::instance ()->wmsConfiguration ( configFilePath , parameterMap );
584
589
if ( !p )
585
590
{
586
591
theRequestHandler->setServiceException ( QgsMapServiceException ( " WMS configuration error" , " There was an error reading the project file or the SLD configuration" ) );
587
592
}
588
593
else
589
594
{
590
- QgsWMSServer wmsServer ( mConfigFilePath , parameterMap, p, theRequestHandler.data (), mMapRenderer , mCapabilitiesCache );
595
+ QgsWMSServer wmsServer ( configFilePath , parameterMap, p, theRequestHandler.data (), mMapRenderer , mCapabilitiesCache );
591
596
wmsServer.executeRequest ();
592
597
}
593
598
}
0 commit comments