[mapguide-commits] r5945 - in branches/2.2/MgDev: Common/MapGuideCommon/Services Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 24 10:42:28 EDT 2011


Author: jng
Date: 2011-06-24 07:42:28 -0700 (Fri, 24 Jun 2011)
New Revision: 5945

Modified:
   branches/2.2/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
   branches/2.2/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: branches/2.2/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
===================================================================
--- branches/2.2/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2011-06-23 16:22:01 UTC (rev 5944)
+++ branches/2.2/MgDev/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2011-06-24 14:42:28 UTC (rev 5945)
@@ -834,6 +834,8 @@
     this->ToXml(xmlStr);
 
     Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)xmlStr.c_str(), (INT32)xmlStr.length());
+    byteSource->SetMimeType(MgMimeType::Xml);
+
     Ptr<MgByteReader> byteReader = byteSource->GetReader();
     return SAFE_ADDREF((MgByteReader*)byteReader);
 }

Modified: branches/2.2/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
===================================================================
--- branches/2.2/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2011-06-23 16:22:01 UTC (rev 5944)
+++ branches/2.2/MgDev/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2011-06-24 14:42:28 UTC (rev 5945)
@@ -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