Skip to content
Permalink
Browse files

[Server][Cache] Add documents to store in cache: WMS Context, WFS Des…

…cribeFeatureType, WCS DescribeCoverage
  • Loading branch information
rldhont committed Sep 15, 2018
1 parent 81db005 commit f79be97e9046f5170ce202377839abd09215d81c
@@ -36,10 +36,29 @@ namespace QgsWcs
void writeDescribeCoverage( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
const QgsServerRequest &request, QgsServerResponse &response )
{
QDomDocument doc = createDescribeCoverageDocument( serverIface, project, version, request );
QgsAccessControl *accessControl = serverIface->accessControls();

QDomDocument doc;
const QDomDocument *describeDocument = nullptr;

QgsServerCacheManager *cacheManager = serverIface->cacheManager();
if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
{
describeDocument = &doc;
}
else //describe feature xml not in cache. Create a new one
{
doc = createDescribeCoverageDocument( serverIface, project, version, request );

if ( cacheManager )
{
cacheManager->setCachedDocument( &doc, project, request, accessControl );
}
describeDocument = &doc;
}

response.setHeader( "Content-Type", "text/xml; charset=utf-8" );
response.write( doc.toByteArray() );
response.write( describeDocument->toByteArray() );
}


@@ -42,10 +42,29 @@ namespace QgsWfs
void writeDescribeFeatureType( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
const QgsServerRequest &request, QgsServerResponse &response )
{
QDomDocument doc = createDescribeFeatureTypeDocument( serverIface, project, version, request );
QgsAccessControl *accessControl = serverIface->accessControls();

QDomDocument doc;
const QDomDocument *describeDocument = nullptr;

QgsServerCacheManager *cacheManager = serverIface->cacheManager();
if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
{
describeDocument = &doc;
}
else //describe feature xml not in cache. Create a new one
{
doc = createDescribeFeatureTypeDocument( serverIface, project, version, request );

if ( cacheManager )
{
cacheManager->setCachedDocument( &doc, project, request, accessControl );
}
describeDocument = &doc;
}

response.setHeader( "Content-Type", "text/xml; charset=utf-8" );
response.write( doc.toByteArray() );
response.write( describeDocument->toByteArray() );
}


@@ -55,10 +55,29 @@ namespace QgsWms
const QString &version, const QgsServerRequest &request,
QgsServerResponse &response )
{
QDomDocument doc = getContext( serverIface, project, version, request );
QgsAccessControl *accessControl = serverIface->accessControls();

QDomDocument doc;
const QDomDocument *contextDocument = nullptr;

QgsServerCacheManager *cacheManager = serverIface->cacheManager();
if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
{
contextDocument = &doc;
}
else //context xml not in cache. Create a new one
{
doc = getContext( serverIface, project, version, request );

if ( cacheManager )
{
cacheManager->setCachedDocument( &doc, project, request, accessControl );
}
contextDocument = &doc;
}

response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
response.write( doc.toByteArray() );
response.write( contextDocument->toByteArray() );
}


0 comments on commit f79be97

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