[server] Add url and post data getters to request handler

This completes the API to eventually get rid of all
getEnv usage from python server plugins.

The request handler has now access to the request URL
and POST data without the need to query the env.
This commit is contained in:
Alessandro Pasotti 2017-05-16 11:05:08 +02:00
parent e3d79a1fe9
commit 2f75bab844
2 changed files with 16 additions and 0 deletions

View File

@ -121,6 +121,16 @@ QByteArray QgsRequestHandler::body() const
return mResponse.data();
}
QByteArray QgsRequestHandler::data() const
{
return mRequest.data( );
}
QString QgsRequestHandler::url() const
{
return mRequest.url( ).toString( );
}
void QgsRequestHandler::setStatusCode( int code )
{
mResponse.setStatusCode( code );

View File

@ -104,6 +104,12 @@ class SERVER_EXPORT QgsRequestHandler
//! Return response body data
QByteArray body() const;
//! Return request POST data (can be null)
QByteArray data() const;
//! Return request url
QString url() const;
//! Set response http status code
void setStatusCode( int code );