From cbef51cc0a864974515b07d460110f94a9e7d033 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Tue, 16 May 2017 11:56:45 +0200 Subject: [PATCH] [server] Sipify QgsRequestHandler --- python/auto_sip.blacklist | 1 - python/server/qgsrequesthandler.sip | 231 +++++++++++++++++++--------- 2 files changed, 160 insertions(+), 72 deletions(-) diff --git a/python/auto_sip.blacklist b/python/auto_sip.blacklist index a676996f5ea..8b531ae3292 100644 --- a/python/auto_sip.blacklist +++ b/python/auto_sip.blacklist @@ -450,7 +450,6 @@ server/qgsaccesscontrolfilter.sip server/qgsaccesscontrol.sip server/qgsmapserviceexception.sip server/qgscapabilitiescache.sip -server/qgsrequesthandler.sip server/qgsserverprojectparser.sip server/qgswmsconfigparser.sip server/qgswmsprojectparser.sip diff --git a/python/server/qgsrequesthandler.sip b/python/server/qgsrequesthandler.sip index 37aca9a22d3..844bfdd8d5e 100644 --- a/python/server/qgsrequesthandler.sip +++ b/python/server/qgsrequesthandler.sip @@ -1,100 +1,189 @@ -/*************************************************************************** - 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 - ***************************************************************************/ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/server/qgsrequesthandler.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ -/** - * \ingroup server - * This class is an interface hiding the details of reading input and writing - * output from/to a wms request mechanism. - * Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage - * as a standalone command line executable - */ -class QgsRequestHandler /Abstract/ + + + + +typedef QList< QPair > QgsColorBox; //Color / number of pixels +typedef QMultiMap< int, QgsColorBox > QgsColorBoxMap; // sum of pixels / color box + +class QgsRequestHandler { -%TypeHeaderCode -#include "qgsserverexception.h" -#include "qgsrequesthandler.h" +%Docstring + This class is an interface hiding the details of reading input and writing + output from/to a wms request mechanism. %End +%TypeHeaderCode +#include "qgsrequesthandler.h" +%End public: - /** Allow plugins to return a QgsServerException*/ + explicit QgsRequestHandler( QgsServerRequest &request, QgsServerResponse &response ); +%Docstring + Constructor + + Note that QgsServerRequest and QgsServerResponse MUST live in the same scope +%End + ~QgsRequestHandler(); + void setServiceException( const QgsServerException &ex ); +%Docstring +Allow plugins to return a QgsMapServiceException +%End - //! Set an HTTP response header - void setResponseHeader( const QString &name, const QString &value ); - - //! Remove an HTTP response header - void removeResponseHeader( const QString &name ); - - //! Retrieve response header value - QString responseHeader( const QString &name ) const; - - //! Return the response headers - QMap responseHeaders() const; - - //! Set an HTTP request header - void setRequestHeader( const QString &name, const QString &value ); - - //! Remove an HTTP request header - void removeRequestHeader( const QString &name ); - - //! Retrieve request header value - QString requestHeader( const QString &name ) const; - - //! Return the Request headers - QMap requestHeaders() const; - - /** Append the bytestream to response body*/ - void appendBody( const QByteArray &body ); - - /** Send out HTTP headers and flush output buffer*/ void sendResponse(); +%Docstring + Send out HTTP headers and flush output buffer - //! Set response http status code - void setStatusCode( int code ); + This method is intended only for streaming + partial content. +%End - //! Return response http status code - int statusCode( ) const; + void setResponseHeader( const QString &name, const QString &value ); +%Docstring +Set an HTTP response header +%End - /** Pointer to last raised exception*/ - bool exceptionRaised() const; + void removeResponseHeader( const QString &name ); +%Docstring +Remove an HTTP response header +%End - /** Clear response buffer */ - void clearBody(); + QString responseHeader( const QString &name ) const; +%Docstring +Retrieve response header value + :rtype: str +%End + + QMap responseHeaders() const; +%Docstring +Return the response headers + :rtype: QMap +%End + + void setRequestHeader( const QString &name, const QString &value ); +%Docstring +Set an HTTP request header +%End + + void removeRequestHeader( const QString &name ); +%Docstring +Remove an HTTP request header +%End + + QString requestHeader( const QString &name ) const; +%Docstring +Retrieve request header value + :rtype: str +%End + + QMap requestHeaders() const; +%Docstring +Return the Request headers + :rtype: QMap +%End - //! Clears the response body and headers void clear(); +%Docstring +Clears the response body and headers +%End + + void appendBody( const QByteArray &body ); +%Docstring +Set the info format string such as "text/xml" +%End + + bool exceptionRaised() const; +%Docstring +Pointer to last raised exception + :rtype: bool +%End + + void clearBody(); +%Docstring +Clear response buffer +%End - /** Return body data */ QByteArray body() const; +%Docstring +Return response body data + :rtype: QByteArray +%End + + QByteArray data() const; +%Docstring +Return request POST data (can be null) + :rtype: QByteArray +%End + + QString url() const; +%Docstring +Return request url + :rtype: str +%End + + void setStatusCode( int code ); +%Docstring +Set response http status code +%End + + int statusCode( ) const; +%Docstring +Return response http status code + :rtype: int +%End - /** Return a copy of the parsed parameters as a key-value pair, to modify - * a parameter setParameter( const QString &key, const QString &value) - * and removeParameter(const QString &key) must be used - */ QMap parameterMap() const; +%Docstring + Return the parsed parameters as a key-value pair, to modify + a parameter setParameter( const QString &key, const QString &value) + and removeParameter(const QString &key) must be used + :rtype: QMap +%End - /** Set a request parameter*/ void setParameter( const QString &key, const QString &value ); +%Docstring +Set a request parameter +%End - /** Remove a request parameter*/ - void removeParameter( const QString &key ); - - /** Return a request parameter*/ QString parameter( const QString &key ) const; +%Docstring +Return a request parameter + :rtype: str +%End + + void removeParameter( const QString &key ); +%Docstring +Remove a request parameter +%End + - /** Return the requested format string*/ QString format() const; +%Docstring +Return the requested format string + :rtype: str +%End - /** Return true if the HTTP headers were already sent to the client*/ bool headersSent() const; +%Docstring +Return true if the HTTP headers were already sent to the client + :rtype: bool +%End + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/server/qgsrequesthandler.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/