2014-10-10 19:28:20 +02:00
|
|
|
/***************************************************************************
|
|
|
|
qgsrequesthandler.sip
|
|
|
|
|
|
|
|
This class is an interface hiding the details of reading input and
|
|
|
|
writing output from/to a wms request mechanism
|
|
|
|
-------------------
|
|
|
|
begin : 2014-09-10
|
|
|
|
copyright : (C) 2014 by Alessandro Pasotti
|
|
|
|
email : a dot pasotti at itopen dot it
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-02-14 03:50:23 +01:00
|
|
|
* \ingroup server
|
|
|
|
* This class is an interface hiding the details of reading input and writing
|
|
|
|
* output from/to a wms request mechanism.
|
2014-10-10 19:28:20 +02:00
|
|
|
* Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage
|
|
|
|
* as a standalone command line executable
|
|
|
|
*/
|
2017-01-05 13:35:20 +01:00
|
|
|
class QgsRequestHandler /Abstract/
|
2014-10-09 15:05:19 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmapserviceexception.h"
|
|
|
|
#include "qgsrequesthandler.h"
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-10-01 11:23:26 +02:00
|
|
|
/** Parses the input and creates a request neutral Parameter/Value map
|
|
|
|
* @note not available in Python bindings
|
|
|
|
*/
|
|
|
|
// virtual void parseInput() = 0;
|
|
|
|
|
|
|
|
/** Sends the map image back to the client
|
|
|
|
* @note not available in Python bindings
|
|
|
|
*/
|
|
|
|
// virtual void setGetMapResponse( const QString& service, QImage* img, int imageQuality ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setGetCapabilitiesResponse( const QDomDocument& doc ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) = 0;
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Allow plugins to return a QgsMapServiceException*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void setServiceException( const QgsMapServiceException& ex /Transfer/ );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setXmlResponse( const QDomDocument& doc ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setXmlResponse( const QDomDocument& doc, const QString& mimeType ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setGetPrintResponse( QByteArray* b ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual void setGetFeatureResponse( QByteArray* ba ) = 0;
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
2017-01-05 13:35:20 +01:00
|
|
|
void endGetFeatureResponse( QByteArray* ba );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
2017-01-05 13:35:20 +01:00
|
|
|
void setGetCoverageResponse( QByteArray* ba );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Set an HTTP header*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void setHeader( const QString &name, const QString &value );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Remove an HTTP header*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void removeHeader( const QString &name );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Delete all HTTP headers*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void clear();
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Append the bytestream to response body*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void appendBody( const QByteArray &body );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Set the info format string such as "text/xml"*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void setInfoFormat( const QString &format );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Send out HTTP headers and flush output buffer*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void sendResponse();
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Pointer to last raised exception*/
|
2017-01-05 13:35:20 +01:00
|
|
|
bool exceptionRaised() const;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Return a copy of the parsed parameters as a key-value pair, to modify
|
2014-10-10 19:28:20 +02:00
|
|
|
* a parameter setParameter( const QString &key, const QString &value)
|
|
|
|
* and removeParameter(const QString &key) must be used
|
|
|
|
*/
|
2015-02-03 02:21:52 +01:00
|
|
|
QMap<QString, QString> parameterMap();
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Set a request parameter*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void setParameter( const QString &key, const QString &value );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Remove a request parameter*/
|
2017-01-05 13:35:20 +01:00
|
|
|
int removeParameter( const QString &key );
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Return a request parameter*/
|
2017-01-05 13:35:20 +01:00
|
|
|
QString parameter( const QString &key ) const;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Return the requested format string*/
|
2014-10-09 15:05:19 +02:00
|
|
|
QString format() const;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Return the mime type for the response*/
|
2014-10-10 19:28:20 +02:00
|
|
|
QString infoFormat() const;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Return true if the HTTP headers were already sent to the client*/
|
2015-02-04 01:37:05 +01:00
|
|
|
bool headersSent();
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
//! @note not available in Python bindings
|
|
|
|
// virtual QPair<QByteArray, QByteArray> getResponse() = 0;
|
|
|
|
|
2015-02-04 07:15:49 +01:00
|
|
|
private:
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Parses the input and creates a request neutral Parameter/Value map*/
|
2017-01-05 13:35:20 +01:00
|
|
|
void parseInput();
|
2014-10-09 15:05:19 +02:00
|
|
|
};
|