Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #4564 from boundlessgeo/server-more-requesthandler…
…-api [server] Add url and post data getters to request handler
- Loading branch information
Showing
with
162 additions
and 58 deletions.
- +0 −1 python/auto_sip.blacklist
- +145 −56 python/server/qgsrequesthandler.sip
- +11 −1 src/server/qgsrequesthandler.cpp
- +6 −0 src/server/qgsrequesthandler.h
@@ -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 | ||
***************************************************************************/ | ||
|
||
|
||
/** | ||
* \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/ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsrequesthandler.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
typedef QList< QPair<QRgb, int> > QgsColorBox; //Color / number of pixels | ||
typedef QMultiMap< int, QgsColorBox > QgsColorBoxMap; // sum of pixels / color box | ||
|
||
class QgsRequestHandler | ||
{ | ||
%Docstring | ||
This class is an interface hiding the details of reading input and writing | ||
output from/to a wms request mechanism. | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsserverexception.h" | ||
#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 | ||
|
||
void sendResponse(); | ||
%Docstring | ||
Send out HTTP headers and flush output buffer | ||
|
||
This method is intended only for streaming | ||
partial content. | ||
%End | ||
|
||
//! Set an HTTP response header | ||
void setResponseHeader( const QString &name, const QString &value ); | ||
%Docstring | ||
Set an HTTP response header | ||
%End | ||
|
||
//! Remove an HTTP response header | ||
void removeResponseHeader( const QString &name ); | ||
%Docstring | ||
Remove an HTTP response header | ||
%End | ||
|
||
//! Retrieve response header value | ||
QString responseHeader( const QString &name ) const; | ||
%Docstring | ||
Retrieve response header value | ||
:rtype: str | ||
%End | ||
|
||
//! Return the response headers | ||
QMap<QString, QString> responseHeaders() const; | ||
%Docstring | ||
Return the response headers | ||
:rtype: QMap<str, QString> | ||
%End | ||
|
||
//! Set an HTTP request header | ||
void setRequestHeader( const QString &name, const QString &value ); | ||
%Docstring | ||
Set an HTTP request header | ||
%End | ||
|
||
//! Remove an HTTP request header | ||
void removeRequestHeader( const QString &name ); | ||
%Docstring | ||
Remove an HTTP request header | ||
%End | ||
|
||
//! Retrieve request header value | ||
QString requestHeader( const QString &name ) const; | ||
%Docstring | ||
Retrieve request header value | ||
:rtype: str | ||
%End | ||
|
||
//! Return the Request headers | ||
QMap<QString, QString> requestHeaders() const; | ||
%Docstring | ||
Return the Request headers | ||
:rtype: QMap<str, QString> | ||
%End | ||
|
||
void clear(); | ||
%Docstring | ||
Clears the response body and headers | ||
%End | ||
|
||
/** Append the bytestream to response body*/ | ||
void appendBody( const QByteArray &body ); | ||
%Docstring | ||
Set the info format string such as "text/xml" | ||
%End | ||
|
||
/** Send out HTTP headers and flush output buffer*/ | ||
void sendResponse(); | ||
bool exceptionRaised() const; | ||
%Docstring | ||
Pointer to last raised exception | ||
:rtype: bool | ||
%End | ||
|
||
//! Set response http status code | ||
void setStatusCode( int code ); | ||
void clearBody(); | ||
%Docstring | ||
Clear response buffer | ||
%End | ||
|
||
//! Return response http status code | ||
int statusCode( ) const; | ||
QByteArray body() const; | ||
%Docstring | ||
Return response body data | ||
:rtype: QByteArray | ||
%End | ||
|
||
/** Pointer to last raised exception*/ | ||
bool exceptionRaised() const; | ||
QByteArray data() const; | ||
%Docstring | ||
Return request POST data (can be null) | ||
:rtype: QByteArray | ||
%End | ||
|
||
/** Clear response buffer */ | ||
void clearBody(); | ||
QString url() const; | ||
%Docstring | ||
Return request url | ||
:rtype: str | ||
%End | ||
|
||
//! Clears the response body and headers | ||
void clear(); | ||
void setStatusCode( int code ); | ||
%Docstring | ||
Set response http status code | ||
%End | ||
|
||
/** Return body data */ | ||
QByteArray body() const; | ||
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<QString, QString> 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<str, QString> | ||
%End | ||
|
||
/** Set a request parameter*/ | ||
void setParameter( const QString &key, const QString &value ); | ||
%Docstring | ||
Set a request parameter | ||
%End | ||
|
||
QString parameter( const QString &key ) const; | ||
%Docstring | ||
Return a request parameter | ||
:rtype: str | ||
%End | ||
|
||
/** Remove a request parameter*/ | ||
void removeParameter( const QString &key ); | ||
%Docstring | ||
Remove a request parameter | ||
%End | ||
|
||
/** Return a request parameter*/ | ||
QString parameter( const QString &key ) const; | ||
|
||
/** 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 * | ||
************************************************************************/ |