[mapguide-commits] r5946 - in trunk/MgDev: Common/MapGuideCommon/Services Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 24 10:51:48 EDT 2011


Author: jng
Date: 2011-06-24 07:51:48 -0700 (Fri, 24 Jun 2011)
New Revision: 5946

Modified:
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
   trunk/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
Log:
#1104: Fix SELECTFEATURES not returning json. The problem was that the ProxyFeatureReader::ToXml() method did not set the mime type of the returned MgByteReader to MgMimeType::Xml, thus the XML to JSON conversion process never kicks in. Also included is a fix for a similar issue with the SELECTAGGREGATES operation.


Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2011-06-24 14:42:28 UTC (rev 5945)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2011-06-24 14:51:48 UTC (rev 5946)
@@ -818,6 +818,8 @@
     this->ToXml(xmlStr);
 
     Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)xmlStr.c_str(), (INT32)xmlStr.length());
+    byteSource->SetMimeType(MgMimeType::Xml);
+
     return byteSource->GetReader();
 }
 

Modified: trunk/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2011-06-24 14:42:28 UTC (rev 5945)
+++ trunk/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2011-06-24 14:51:48 UTC (rev 5946)
@@ -114,7 +114,12 @@
     }
 
     Ptr<MgDataReader> dataReader = service->SelectAggregate(&resId, m_className, qryOptions);
-    hResult->SetResultObject(dataReader, MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = dataReader->ToXml();
 
+    //Convert to alternate response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpSelectFeaturesSpatially.Execute")
 }



More information about the mapguide-commits mailing list