Skip to content
Permalink
Browse files

Move wcs as service module

  • Loading branch information
dmarteau committed Jan 17, 2017
1 parent 56b2f08 commit e17a7d4e217d70d4dd80b4a8bcb8dab514e1a2a7
Showing with 1,026 additions and 886 deletions.
  1. +6 −1 doc/CMakeLists.txt
  2. +7 −0 doc/api_break.dox
  3. +0 −9 python/server/qgsrequesthandler.sip
  4. +1 −0 python/server/qgsserverexception.sip
  5. +15 −0 python/server/qgsserverrequest.sip
  6. +0 −2 src/server/CMakeLists.txt
  7. +0 −66 src/server/qgsowsserver.cpp
  8. +0 −110 src/server/qgsowsserver.h
  9. +0 −65 src/server/qgsrequesthandler.cpp
  10. +0 −20 src/server/qgsrequesthandler.h
  11. +0 −29 src/server/qgsserver.cpp
  12. +16 −4 src/server/qgsserverexception.h
  13. +5 −0 src/server/qgsserverrequest.h
  14. +2 −0 src/server/qgsserverresponse.h
  15. +1 −0 src/server/qgsservice.h
  16. +1 −0 src/server/qgsserviceregistry.h
  17. +0 −493 src/server/qgswcsserver.cpp
  18. +0 −73 src/server/qgswcsserver.h
  19. +1 −0 src/server/services/CMakeLists.txt
  20. +59 −0 src/server/services/wcs/CMakeLists.txt
  21. +124 −0 src/server/services/wcs/qgswcs.cpp
  22. +83 −0 src/server/services/wcs/qgswcsdescribecoverage.cpp
  23. +41 −0 src/server/services/wcs/qgswcsdescribecoverage.h
  24. +121 −0 src/server/services/wcs/qgswcsgetcapabilities.cpp
  25. +41 −0 src/server/services/wcs/qgswcsgetcapabilities.h
  26. +205 −0 src/server/services/wcs/qgswcsgetcoverage.cpp
  27. +40 −0 src/server/services/wcs/qgswcsgetcoverage.h
  28. +80 −0 src/server/services/wcs/qgswcsserviceexception.h
  29. +94 −0 src/server/services/wcs/qgswcsutils.cpp
  30. +70 −0 src/server/services/wcs/qgswcsutils.h
  31. +0 −4 src/server/services/wfs/CMakeLists.txt
  32. +1 −0 src/server/services/wfs/qgswfsdescribefeaturetype.h
  33. +1 −0 src/server/services/wfs/qgswfsgetcapabilities.h
  34. +1 −0 src/server/services/wfs/qgswfsutils.h
  35. +10 −10 src/server/services/wms/qgswms.cpp
@@ -84,11 +84,16 @@ IF(WITH_APIDOC)
${DOXYGEN_INPUT}
${CMAKE_SOURCE_DIR}/src/server/qgsserver.h
${CMAKE_SOURCE_DIR}/src/server/qgscapabilitiescache.h
${CMAKE_SOURCE_DIR}/src/server/qgsmapserviceexception.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverexception.h
${CMAKE_SOURCE_DIR}/src/server/qgsrequesthandler.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverfilter.h
${CMAKE_SOURCE_DIR}/src/server/qgsaccesscontrolfilter.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverinterface.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverrequest.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverresponse.h
${CMAKE_SOURCE_DIR}/src/server/qgsserverrequest.h
${CMAKE_SOURCE_DIR}/src/server/qgsservice.h
${CMAKE_SOURCE_DIR}/src/server/qgsserviceregistry.h
)
ENDIF(WITH_SERVER_PLUGINS)

@@ -1898,6 +1898,13 @@ optional property map passing down layer level properties to the SLD encoders. I
- usedAttributes is now a const method and returns QSet<QString> instead of QStringList


QgsRequestHandler {#qgis_api_break_3_0_QgsRequestHandler}
-----------------

- Removed infoFormat and setInfoFormat methods: the format of the response is given and set with the "Content-Type" header.
- Removed setCoverageResponse


Processing {#qgis_api_break_3_0_Processing}
----------

@@ -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 setGetCoverageResponse( QByteArray* ba );

/** Set an HTTP header*/
void setHeader( const QString &name, const QString &value );

@@ -50,9 +47,6 @@ class QgsRequestHandler /Abstract/
/** Append the bytestream to response body*/
void appendBody( const QByteArray &body );

/** Set the info format string such as "text/xml"*/
void setInfoFormat( const QString &format );

/** Send out HTTP headers and flush output buffer*/
void sendResponse();

@@ -77,9 +71,6 @@ class QgsRequestHandler /Abstract/
/** Return the requested format string*/
QString format() const;

/** Return the mime type for the response*/
QString infoFormat() const;

/** Return true if the HTTP headers were already sent to the client*/
bool headersSent() const;
};
@@ -47,6 +47,7 @@ class QgsOgcServiceException
QString message() const;
QString code() const;
QString locator() const;
QString version() const;

virtual QByteArray formatResponse( QString& responseFormat / Out / ) const;
};
@@ -79,6 +79,21 @@ class QgsServerRequest
*/
QMap<QString, QString> parameters() const;

/**
* Set a parameter
*/
void setParameter( const QString& key, const QString& value );

/**
* Get a parameter value
*/
QString getParameter( const QString& key ) const;

/**
* Remove a parameter
*/
void removeParameter( const QString& key );

/**
* Return post/put data
* Check for QByteArray::isNull() to check if data
@@ -24,8 +24,6 @@ SET ( qgis_mapserv_SRCS
qgscapabilitiescache.cpp
qgsconfigcache.cpp
qgsrequesthandler.cpp
qgsowsserver.cpp
qgswcsserver.cpp
qgsserversettings.cpp
qgsserverexception.cpp
qgsmslayercache.cpp

This file was deleted.

This file was deleted.

@@ -53,20 +53,6 @@ QMap<QString, QString> QgsRequestHandler::parameterMap() const
return mRequest.parameters();
}

void QgsRequestHandler::setHttpResponse( const QByteArray& ba, const QString &format )
{
QgsMessageLog::logMessage( QStringLiteral( "Checking byte array is ok to set..." ) );

if ( ba.size() < 1 )
{
return;
}

QgsMessageLog::logMessage( QStringLiteral( "Byte array looks good, setting response..." ) );
appendBody( ba );
setInfoFormat( format );
}

bool QgsRequestHandler::exceptionRaised() const
{
return mExceptionRaised;
@@ -107,70 +93,19 @@ void QgsRequestHandler::appendBody( const QByteArray &body )
mResponse.write( body );
}

void QgsRequestHandler::setInfoFormat( const QString &format )
{
mInfoFormat = format;

// Update header
QString fmt = mInfoFormat;
if ( mInfoFormat.startsWith( QLatin1String( "text/" ) ) || mInfoFormat.startsWith( QLatin1String( "application/vnd.ogc.gml" ) ) )
{
fmt.append( "; charset=utf-8" );
}
setHeader( QStringLiteral( "Content-Type" ), fmt );

}

void QgsRequestHandler::sendResponse()
{
// Send data to output
mResponse.flush();
}



QString QgsRequestHandler::formatToMimeType( const QString& format ) const
{
if ( format.compare( QLatin1String( "png" ), Qt::CaseInsensitive ) == 0 )
{
return QStringLiteral( "image/png" );
}
else if ( format.compare( QLatin1String( "jpg" ), Qt::CaseInsensitive ) == 0 )
{
return QStringLiteral( "image/jpeg" );
}
else if ( format.compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
{
return QStringLiteral( "image/svg+xml" );
}
else if ( format.compare( QLatin1String( "pdf" ), Qt::CaseInsensitive ) == 0 )
{
return QStringLiteral( "application/pdf" );
}
return format;
}

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

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

void QgsRequestHandler::setGetCoverageResponse( QByteArray* ba )
{
if ( ba )
{
setHttpResponse( *ba, QStringLiteral( "image/tiff" ) );
}
}

void QgsRequestHandler::setupParameters()
{
const QgsServerRequest::Parameters parameters = mRequest.parameters();

0 comments on commit e17a7d4

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