QGIS/python/server/qgsrequesthandler.sip
Alessandro Pasotti d03b005969 [server] Expose HTTP status code and test refactoring
* Renamed returnCode to statusCode (as per RFC https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
* Expose statusCode to server iface
* API Break: Renamed getHeader() to header() Qt-style
* Split server plugin filter tests in its own test file
* Added tests for clearBody() and body() getter
2017-04-22 10:17:08 +02:00

89 lines
2.6 KiB
Plaintext

/***************************************************************************
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/
{
%TypeHeaderCode
#include "qgsserverexception.h"
#include "qgsrequesthandler.h"
%End
public:
/** Allow plugins to return a QgsServerException*/
void setServiceException( const QgsServerException &ex );
/** Set an HTTP header*/
void setHeader( const QString &name, const QString &value );
//! Retrieve header value
QString header( const QString &name ) const;
//! Return the list of all header keys
QList<QString> headerKeys() const;
/** Remove an HTTP header*/
void removeHeader( const QString &name );
/** Delete all HTTP headers*/
void clear();
/** Append the bytestream to response body*/
void appendBody( const QByteArray &body );
/** Send out HTTP headers and flush output buffer*/
void sendResponse();
//! Set response http status code
void setStatusCode( int code );
//! Return response http status code
int statusCode( ) const;
/** Pointer to last raised exception*/
bool exceptionRaised() const;
/** Clear response buffer */
void clearBody();
/** Return body data */
QByteArray body() const;
/** 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;
/** Set a request parameter*/
void setParameter( const QString &key, const QString &value );
/** Remove a request parameter*/
void removeParameter( const QString &key );
/** Return a request parameter*/
QString parameter( const QString &key ) const;
/** Return the requested format string*/
QString format() const;
/** Return true if the HTTP headers were already sent to the client*/
bool headersSent() const;
};