@@ -53,20 +53,6 @@ QMap<QString, QString> QgsRequestHandler::parameterMap() const
5353 return mRequest .parameters ();
5454}
5555
56- void QgsRequestHandler::setHttpResponse ( const QByteArray& ba, const QString &format )
57- {
58- QgsMessageLog::logMessage ( QStringLiteral ( " Checking byte array is ok to set..." ) );
59-
60- if ( ba.size () < 1 )
61- {
62- return ;
63- }
64-
65- QgsMessageLog::logMessage ( QStringLiteral ( " Byte array looks good, setting response..." ) );
66- appendBody ( ba );
67- setInfoFormat ( format );
68- }
69-
7056bool QgsRequestHandler::exceptionRaised () const
7157{
7258 return mExceptionRaised ;
@@ -107,70 +93,19 @@ void QgsRequestHandler::appendBody( const QByteArray &body )
10793 mResponse .write ( body );
10894}
10995
110- void QgsRequestHandler::setInfoFormat ( const QString &format )
111- {
112- mInfoFormat = format;
113-
114- // Update header
115- QString fmt = mInfoFormat ;
116- if ( mInfoFormat .startsWith ( QLatin1String ( " text/" ) ) || mInfoFormat .startsWith ( QLatin1String ( " application/vnd.ogc.gml" ) ) )
117- {
118- fmt.append ( " ; charset=utf-8" );
119- }
120- setHeader ( QStringLiteral ( " Content-Type" ), fmt );
121-
122- }
123-
12496void QgsRequestHandler::sendResponse ()
12597{
12698 // Send data to output
12799 mResponse .flush ();
128100}
129101
130-
131-
132- QString QgsRequestHandler::formatToMimeType ( const QString& format ) const
133- {
134- if ( format.compare ( QLatin1String ( " png" ), Qt::CaseInsensitive ) == 0 )
135- {
136- return QStringLiteral ( " image/png" );
137- }
138- else if ( format.compare ( QLatin1String ( " jpg" ), Qt::CaseInsensitive ) == 0 )
139- {
140- return QStringLiteral ( " image/jpeg" );
141- }
142- else if ( format.compare ( QLatin1String ( " svg" ), Qt::CaseInsensitive ) == 0 )
143- {
144- return QStringLiteral ( " image/svg+xml" );
145- }
146- else if ( format.compare ( QLatin1String ( " pdf" ), Qt::CaseInsensitive ) == 0 )
147- {
148- return QStringLiteral ( " application/pdf" );
149- }
150- return format;
151- }
152-
153- void QgsRequestHandler::setGetCapabilitiesResponse ( const QDomDocument& doc )
154- {
155- QByteArray ba = doc.toByteArray ();
156- setHttpResponse ( ba, QStringLiteral ( " text/xml" ) );
157- }
158-
159102void QgsRequestHandler::setServiceException ( const QgsServerException& ex )
160103{
161104 // Safety measure to avoid potential leaks if called repeatedly
162105 mExceptionRaised = true ;
163106 mResponse .write ( ex );
164107}
165108
166- void QgsRequestHandler::setGetCoverageResponse ( QByteArray* ba )
167- {
168- if ( ba )
169- {
170- setHttpResponse ( *ba, QStringLiteral ( " image/tiff" ) );
171- }
172- }
173-
174109void QgsRequestHandler::setupParameters ()
175110{
176111 const QgsServerRequest::Parameters parameters = mRequest .parameters ();
0 commit comments