Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Working implementation
Funded by ItOpen - http://www.itopen.it
  • Loading branch information
elpaso committed Nov 26, 2014
1 parent 856e4de commit 8bd78b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mapserver/qgshttprequesthandler.cpp
Expand Up @@ -401,6 +401,10 @@ void QgsHttpRequestHandler::setServiceException( QgsMapServiceException ex )
serviceExceptionReportElem.appendChild( serviceExceptionElem );

QByteArray ba = exceptionDoc.toByteArray();
// Clear response headers and body and set new exception
// TODO: check for headersSent()
clearHeaders();
clearBody();
setHttpResponse( &ba, "text/xml" );
}

Expand Down
7 changes: 7 additions & 0 deletions src/mapserver/qgsrequesthandler.h
Expand Up @@ -75,14 +75,21 @@ class QgsRequestHandler
virtual int removeParameter( const QString &key ) = 0;
/**Return a request parameter*/
virtual QString parameter( const QString &key ) const = 0;
/**Return the response body*/
virtual QByteArray* body( ) { return &mBody; }
/**Return the requested format string*/
QString format() const { return mFormat; }
/**Return the mime type for the response*/
QString infoFormat() const { return mInfoFormat; }
/**Return true if the HTTP headers were already sent to the client*/
bool headersSent() { return mHeadersSent; }
QString infoFormat() const { return mInfoFormat; }

protected:

virtual void sendHeaders( ) = 0;
virtual void sendBody( ) const = 0;
QByteArray mBody; // The response payload
/**This is set by the parseInput methods of the subclasses (parameter FORMAT, e.g. 'FORMAT=PNG')*/
QByteArray mBody; // The response payload
QString mFormat;
Expand Down

0 comments on commit 8bd78b3

Please sign in to comment.