Skip to content

Commit

Permalink
Move wfs as service module
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau committed Jan 17, 2017
1 parent c80e5d1 commit 56b2f08
Show file tree
Hide file tree
Showing 28 changed files with 2,745 additions and 2,526 deletions.
3 changes: 0 additions & 3 deletions python/server/qgsrequesthandler.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
4 changes: 1 addition & 3 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ SET ( qgis_mapserv_SRCS
qgsconfigcache.cpp
qgsrequesthandler.cpp
qgsowsserver.cpp
qgswfsserver.cpp
qgswcsserver.cpp
qgsserversettings.cpp
qgsserverexception.cpp
Expand All @@ -43,7 +42,6 @@ SET ( qgis_mapserv_SRCS
qgswmsconfigparser.cpp
qgswmsprojectparser.cpp
qgsserverprojectparser.cpp
qgsserverstreamingdevice.cpp
qgssldconfigparser.cpp
qgsconfigparserutils.cpp
qgsserver.cpp
Expand All @@ -56,6 +54,7 @@ SET ( qgis_mapserv_SRCS
qgsfcgiserverresponse.cpp
qgsbufferserverresponse.cpp
qgsfilterresponsedecorator.cpp
qgsfilterrestorer.cpp
#----------------------------
)
IF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")
Expand All @@ -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")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
64 changes: 0 additions & 64 deletions src/server/qgsrequesthandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
15 changes: 0 additions & 15 deletions src/server/qgsrequesthandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
25 changes: 0 additions & 25 deletions src/server/qgsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" ),
Expand Down
58 changes: 0 additions & 58 deletions src/server/qgsserverstreamingdevice.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions src/server/qgsserverstreamingdevice.h

This file was deleted.

Loading

0 comments on commit 56b2f08

Please sign in to comment.