20 #include <QDomDocument> 
   25   , mResponseCode( responseCode )
 
   33   QDomElement root = doc.createElement( QStringLiteral( 
"ServerException" ) );
 
   34   doc.appendChild( root );
 
   35   root.appendChild( doc.createTextNode( 
what() ) );
 
   37   responseFormat = QStringLiteral( 
"text/xml; charset=utf-8" );
 
   38   return doc.toByteArray();
 
   44     int responseCode, 
const QString &version )
 
   57   QDomElement root = doc.createElement( QStringLiteral( 
"ServiceExceptionReport" ) );
 
   58   root.setAttribute( QStringLiteral( 
"version" ), mVersion );
 
   59   root.setAttribute( QStringLiteral( 
"xmlns" ), QStringLiteral( 
"http://www.opengis.net/ogc" ) );
 
   60   doc.appendChild( root );
 
   62   QDomElement elem = doc.createElement( QStringLiteral( 
"ServiceException" ) );
 
   63   elem.setAttribute( QStringLiteral( 
"code" ), mCode );
 
   64   elem.appendChild( doc.createTextNode( mMessage ) );
 
   65   root.appendChild( elem );
 
   67   if ( ! mLocator.isEmpty() )
 
   69     elem.setAttribute( QStringLiteral( 
"locator" ), mLocator );
 
   72   responseFormat = QStringLiteral( 
"text/xml; charset=utf-8" );
 
   73   return doc.toByteArray();
 
Defines a QGIS exception class.
QgsOgcServiceException(const QString &code, const QString &message, const QString &locator=QString(), int responseCode=200, const QString &version=QStringLiteral("1.3.0"))
Construction.
QByteArray formatResponse(QString &responseFormat) const override
Formats the exception for sending to client.
Exception base class for server exceptions.
virtual QByteArray formatResponse(QString &responseFormat) const
Formats the exception for sending to client.
QgsServerException(const QString &message, int responseCode=500)
Constructor.