Skip to content
Permalink
Browse files

Move wfs as service module

  • Loading branch information
dmarteau committed Jan 17, 2017
1 parent c80e5d1 commit 56b2f08865a2c6f1ddebd9a9c774c9f523d056b7
@@ -29,9 +29,6 @@ class QgsRequestHandler /Abstract/
/** Allow plugins to return a QgsServerException*/
void setServiceException( const QgsServerException& ex );

//! @note not available in Python bindings
void endGetFeatureResponse( QByteArray* ba );

//! @note not available in Python bindings
void setGetCoverageResponse( QByteArray* ba );

@@ -25,7 +25,6 @@ SET ( qgis_mapserv_SRCS
qgsconfigcache.cpp
qgsrequesthandler.cpp
qgsowsserver.cpp
qgswfsserver.cpp
qgswcsserver.cpp
qgsserversettings.cpp
qgsserverexception.cpp
@@ -43,7 +42,6 @@ SET ( qgis_mapserv_SRCS
qgswmsconfigparser.cpp
qgswmsprojectparser.cpp
qgsserverprojectparser.cpp
qgsserverstreamingdevice.cpp
qgssldconfigparser.cpp
qgsconfigparserutils.cpp
qgsserver.cpp
@@ -56,6 +54,7 @@ SET ( qgis_mapserv_SRCS
qgsfcgiserverresponse.cpp
qgsbufferserverresponse.cpp
qgsfilterresponsedecorator.cpp
qgsfilterrestorer.cpp
#----------------------------
)
IF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")
@@ -76,7 +75,6 @@ SET (qgis_mapserv_MOC_HDRS
qgsmslayercache.h
qgsserverlogger.h
qgsserversettings.h
qgsserverstreamingdevice.h
)

IF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")
File renamed without changes.
@@ -19,14 +19,15 @@
#define QGSFILTERRESTORER_H

#include "qgsaccesscontrol.h"
#include "qgis_server.h"

#include <QHash>

class QgsMapLayer;

/** RAII class to restore layer filters on destruction
*/
class QgsOWSServerFilterRestorer
class SERVER_EXPORT QgsOWSServerFilterRestorer
{
public:

@@ -156,77 +156,13 @@ void QgsRequestHandler::setGetCapabilitiesResponse( const QDomDocument& doc )
setHttpResponse( ba, QStringLiteral( "text/xml" ) );
}

void QgsRequestHandler::setXmlResponse( const QDomDocument& doc )
{
QByteArray ba = doc.toByteArray();
setHttpResponse( ba, QStringLiteral( "text/xml" ) );
}

void QgsRequestHandler::setXmlResponse( const QDomDocument& doc, const QString& mimeType )
{
QByteArray ba = doc.toByteArray();
setHttpResponse( ba, mimeType );
}

void QgsRequestHandler::setServiceException( const QgsServerException& ex )
{
// Safety measure to avoid potential leaks if called repeatedly
mExceptionRaised = true;
mResponse.write( ex );
}

bool QgsRequestHandler::startGetFeatureResponse( QByteArray* ba, const QString& infoFormat )
{
if ( !ba )
{
return false;
}

if ( ba->size() < 1 )
{
return false;
}

QString format;
if ( infoFormat == QLatin1String( "GeoJSON" ) )
format = QStringLiteral( "text/plain" );
else
format = QStringLiteral( "text/xml" );

setInfoFormat( format );
appendBody( *ba );
// Streaming
sendResponse();
return true;
}

void QgsRequestHandler::setGetFeatureResponse( QByteArray* ba )
{
if ( !ba )
{
return;
}

if ( ba->size() < 1 )
{
return;
}
appendBody( *ba );
// Streaming
sendResponse();
}

void QgsRequestHandler::endGetFeatureResponse( QByteArray* ba )
{
if ( !ba )
{
return;
}
appendBody( *ba );
// do NOT call sendResponse()
// finish will be called at the end of the transaction
}

void QgsRequestHandler::setGetCoverageResponse( QByteArray* ba )
{
if ( ba )
@@ -60,21 +60,6 @@ class SERVER_EXPORT QgsRequestHandler
//! Allow plugins to return a QgsMapServiceException
void setServiceException( const QgsServerException &ex );

//! @note not available in Python bindings
void setXmlResponse( const QDomDocument& doc );

//! @note not available in Python bindings
void setXmlResponse( const QDomDocument& doc, const QString& mimeType );

//! @note not available in Python bindings
bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat );

//! @note not available in Python bindings
void setGetFeatureResponse( QByteArray* ba );

//! @note not available in Python bindings
void endGetFeatureResponse( QByteArray* ba );

//! @note not available in Python bindings
void setGetCoverageResponse( QByteArray* ba );

@@ -31,7 +31,6 @@
#include "qgsproject.h"
#include "qgsproviderregistry.h"
#include "qgslogger.h"
#include "qgswfsserver.h"
#include "qgswcsserver.h"
#include "qgsmapserviceexception.h"
#include "qgspallabeling.h"
@@ -464,30 +463,6 @@ void QgsServer::handleRequest( QgsServerRequest& request, QgsServerResponse& res
wcsServer.executeRequest();
}
}
else if ( serviceString == QLatin1String( "WFS" ) )
{
QgsWfsProjectParser* p = QgsConfigCache::instance()->wfsConfiguration(
configFilePath
, accessControl
);
if ( !p )
{
theRequestHandler.setServiceException( QgsMapServiceException( QStringLiteral( "Project file error" ),
QStringLiteral( "Error reading the project file" ) ) );
}
else
{
QgsWfsServer wfsServer(
configFilePath
, sSettings
, parameterMap
, p
, &theRequestHandler
, accessControl
);
wfsServer.executeRequest();
}
}
else
{
throw QgsOgcServiceException( QStringLiteral( "Service configuration error" ),

This file was deleted.

This file was deleted.

0 comments on commit 56b2f08

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