void QgsPostRequestHandler::parseInput() { QgsDebugMsg( "QgsPostRequestHandler::parseInput" ); QString inputString = readPostBody(); QgsDebugMsg( inputString ); //Map parameter in QUERY_STRING? const char* qs = getenv( "QUERY_STRING" ); QMap<QString, QString> getParameters; QString queryString; QString mapParameter; if ( qs ) { queryString = QString( qs ); requestStringToParameterMap( queryString, getParameters ); mapParameter = getParameters.value( "MAP" ); } QDomDocument doc; QString errorMsg; if ( !doc.setContent( inputString, true, &errorMsg ) ) { requestStringToParameterMap( inputString, mParameterMap ); } else { QString queryString; const char* qs = getenv( "QUERY_STRING" ); if ( qs ) { queryString = QString( qs ); QgsDebugMsg( "query string is: " + queryString ); } else { QgsDebugMsg( "error, no query string found but a QDomDocument" ); return; //no query string? something must be wrong... } requestStringToParameterMap( queryString, mParameterMap ); QDomElement docElem = doc.documentElement(); if ( docElem.hasAttribute( "version" ) ) mParameterMap.insert( "VERSION", docElem.attribute( "version" ) ); if ( docElem.hasAttribute( "service" ) ) mParameterMap.insert( "SERVICE", docElem.attribute( "service" ) ); mParameterMap.insert( "REQUEST", docElem.tagName() ); mParameterMap.insert( "REQUEST_BODY", inputString ); } if ( !mapParameter.isEmpty() && !mParameterMap.contains( "MAP" ) ) { mParameterMap.insert( "MAP", mapParameter ); } }
QMap<QString, QString> QgsPostRequestHandler::parseInput() { QgsDebugMsg( "QgsPostRequestHandler::parseInput" ); QMap<QString, QString> parameters; QString inputString = readPostBody(); QgsDebugMsg( inputString ); QDomDocument doc; QString errorMsg; if ( !doc.setContent( inputString, true, &errorMsg ) ) { requestStringToParameterMap( inputString, parameters ); } else { QString queryString; const char* qs = getenv( "QUERY_STRING" ); if ( qs ) { queryString = QString( qs ); QgsDebugMsg( "query string is: " + queryString ); } else { QgsDebugMsg( "error, no query string found but a QDomDocument" ); return parameters; //no query string? something must be wrong... } requestStringToParameterMap( queryString, parameters ); QDomElement docElem = doc.documentElement(); parameters.insert( "VERSION", docElem.attribute( "version" ) ); parameters.insert( "SERVICE", docElem.attribute( "service" ) ); parameters.insert( "REQUEST", docElem.tagName() ); parameters.insert( "REQUEST_BODY", inputString ); } return parameters; }
void QgsGetRequestHandler::parseInput() { QString queryString; const char* qs = getenv( "QUERY_STRING" ); if ( qs ) { queryString = QString( qs ); QgsDebugMsg( "query string is: " + queryString ); } else { QgsDebugMsg( "error, no query string found" ); return; //no query string? something must be wrong... } requestStringToParameterMap( queryString, mParameterMap ); }
void QgsPostRequestHandler::parseInput() { QgsMessageLog::logMessage( QStringLiteral( "QgsPostRequestHandler::parseInput" ) ); QString inputString = readPostBody(); QgsMessageLog::logMessage( inputString ); //Map parameter in QUERY_STRING? const char* qs = getenv( "QUERY_STRING" ); QMap<QString, QString> getParameters; QString queryString; QString mapParameter; if ( qs ) { queryString = QString( qs ); requestStringToParameterMap( queryString, getParameters ); mapParameter = getParameters.value( QStringLiteral( "MAP" ) ); } QDomDocument doc; QString errorMsg; int line; int column; if ( !doc.setContent( inputString, true, &errorMsg, &line, &column ) ) { char* requestMethod = getenv( "REQUEST_METHOD" ); if ( requestMethod && strcmp( requestMethod, "POST" ) == 0 ) { QgsMessageLog::logMessage( QStringLiteral( "Error at line %1, column %2: %3." ).arg( line ).arg( column ).arg( errorMsg ) ); } requestStringToParameterMap( inputString, mParameterMap ); } else { QString queryString; const char* qs = getenv( "QUERY_STRING" ); if ( qs ) { queryString = QString( qs ); QgsMessageLog::logMessage( "query string is: " + queryString ); } else { QgsMessageLog::logMessage( QStringLiteral( "error, no query string found but a QDomDocument" ) ); return; //no query string? something must be wrong... } requestStringToParameterMap( queryString, mParameterMap ); QDomElement docElem = doc.documentElement(); if ( docElem.hasAttribute( QStringLiteral( "version" ) ) ) mParameterMap.insert( QStringLiteral( "VERSION" ), docElem.attribute( QStringLiteral( "version" ) ) ); if ( docElem.hasAttribute( QStringLiteral( "service" ) ) ) mParameterMap.insert( QStringLiteral( "SERVICE" ), docElem.attribute( QStringLiteral( "service" ) ) ); mParameterMap.insert( QStringLiteral( "REQUEST" ), docElem.tagName() ); mParameterMap.insert( QStringLiteral( "REQUEST_BODY" ), inputString ); } if ( !mapParameter.isEmpty() && !mParameterMap.contains( QStringLiteral( "MAP" ) ) ) { mParameterMap.insert( QStringLiteral( "MAP" ), mapParameter ); } }