[mapguide-commits] r7270 - in sandbox/jng/streaming: Common/MapGuideCommon/Services Common/PlatformBase/Services Server/src/Services/Feature Web/src/ApacheAgent Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Dec 14 09:41:17 PST 2012


Author: jng
Date: 2012-12-14 09:41:16 -0800 (Fri, 14 Dec 2012)
New Revision: 7270

Added:
   sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.cpp
   sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.h
Modified:
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.cpp
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.h
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.h
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp
   sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.h
   sandbox/jng/streaming/Common/PlatformBase/Services/Reader.h
   sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.cpp
   sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.h
   sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.cpp
   sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.h
   sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
   sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.h
   sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.cpp
   sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.h
   sandbox/jng/streaming/Web/src/ApacheAgent/ApacheAgent.vcxproj
   sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.cpp
   sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.h
   sandbox/jng/streaming/Web/src/HttpHandler/HttpExecuteSqlQuery.cpp
   sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.h
   sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj
   sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj.filters
   sandbox/jng/streaming/Web/src/HttpHandler/HttpHandlerBuild.cpp
   sandbox/jng/streaming/Web/src/HttpHandler/HttpRequestResponseHandler.cpp
   sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeatures.cpp
   sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
Log:
#2194: This submission includes the following changes:
 - Streamline the ToXml() implementation of all respective readers (even though we don't really use them now)
 - Add new internal MgReader APIs:
    - GetResponseElementName() - returns the name of the root response element
    - GetBodyElementName() - returns the name of the body element
    - Server implementations throw exceptions like the other APIs (they will never get called server-side)
 - Extract out the existing Apache reader streaming logic into a re-usable MgHttpReaderStreamer base class with an Apache sub-class to handle the apache-specific calls
 - Use this MgHttpReaderStreamer class in conjunction with the new internal MgReader APIs to implement the JSON streamed output via the same chunked transfer encoding. If you thought the gains by streaming XML were impressive, streaming the JSON is even more impressive (in terms of % improvement) with the same query parameters (SELECTFEATURES on Sheboygan parcels, 17k results):
    - Current implementation: 1.4GB memory spike (!!!) before steadying
    - This submisssion: 2 - 2.5MB

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.cpp
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -682,44 +682,54 @@
     CHECKNULL((MgPropertyDefinitionCollection*)m_propDefCol, L"MgProxyDataReader.ToXml");
 
     // this XML follows the SelectAggregate-1.0.0.xsd schema
-    str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<PropertySet>";
-    m_propDefCol->ToXml(str);
-    str += "<Properties>";
+    ResponseStartUtf8(str);
+    HeaderToStringUtf8(str);
+    BodyStartUtf8(str);
     while ( this->ReadNext() )
     {
-        Ptr<MgPropertyCollection> propCol = m_set->GetItem(m_currRecord-1);
-        INT32 cnt = propCol->GetCount();
-        if (propCol != NULL && cnt > 0)
-        {
-            str += "<PropertyCollection>";
-            propCol->ToXml(str,false);
-            str += "</PropertyCollection>";
-        }
+        CurrentToStringUtf8(str);
     }
-    str += "</Properties>";
-    str += "</PropertySet>";
+    BodyEndUtf8(str);
+    ResponseEndUtf8(str);
 }
 
+string MgProxyDataReader::GetResponseElementName()
+{
+    return "PropertySet";
+}
+
+string MgProxyDataReader::GetBodyElementName()
+{
+    return "Properties";
+}
+
 void MgProxyDataReader::ResponseStartUtf8(string& str)
 {
     str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<PropertySet>";
+    str += "<";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyDataReader::ResponseEndUtf8(string& str)
 {
-    str += "</PropertySet>";
+    str += "</";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyDataReader::BodyStartUtf8(string& str)
 {
-    str += "<Properties>";
+    str += "<";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyDataReader::BodyEndUtf8(string& str)
 {
-    str += "</Properties>";
+    str += "</";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyDataReader::HeaderToStringUtf8(string& str)

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.h
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyDataReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -517,6 +517,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -833,43 +833,55 @@
     {
         // TODO: define a schema for this XML
         // TODO: rename FeatureSet element to avoid conflict with FeatureSet-1.0.0.xsd?
-        str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-        str += "<FeatureSet>";
-        classDef->ToXml(str);
-        str += "<Features>";
+        ResponseStartUtf8(str);
+        HeaderToStringUtf8(str);
+        BodyStartUtf8(str);
         while ( this->ReadNext() )
         {
-            Ptr<MgPropertyCollection> propCol = m_set->GetFeatureAt(m_currRecord-1);
-            INT32 cnt = propCol->GetCount();
-            if (propCol != NULL && cnt > 0)
-            {
-                propCol->ToFeature(str);
-            }
+            CurrentToStringUtf8(str);
         }
-        str += "</Features>";
-        str += "</FeatureSet>";
+        BodyEndUtf8(str);
+        ResponseEndUtf8(str);
     }
 }
 
+string MgProxyFeatureReader::GetResponseElementName()
+{
+    return "FeatureSet";
+}
+
+string MgProxyFeatureReader::GetBodyElementName()
+{
+    return "Features";
+}
+
 void MgProxyFeatureReader::ResponseStartUtf8(string& str)
 {
     str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<FeatureSet>";
+    str += "<";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyFeatureReader::ResponseEndUtf8(string& str)
 {
-    str += "</FeatureSet>";
+    str += "</";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyFeatureReader::BodyStartUtf8(string& str)
 {
-    str += "<Features>";
+    str += "<";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyFeatureReader::BodyEndUtf8(string& str)
 {
-    str += "</Features>";
+    str += "</";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyFeatureReader::HeaderToStringUtf8(string& str)

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.h
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyFeatureReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -490,6 +490,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -768,43 +768,55 @@
     {
         // TODO: define a schema for this XML
         // TODO: rename FeatureSet element to avoid conflict with FeatureSet-1.0.0.xsd?
-        str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-        str += "<FeatureSet>";
-        classDef->ToXml(str);
-        str += "<Features>";
+        ResponseStartUtf8(str);
+        HeaderToStringUtf8(str);
+        BodyStartUtf8(str);
         while ( this->ReadNext() )
         {
-            Ptr<MgPropertyCollection> propCol = m_set->GetFeatureAt(m_currRecord-1);
-            INT32 cnt = propCol->GetCount();
-            if (propCol != NULL && cnt > 0)
-            {
-                propCol->ToFeature(str);
-            }
+            CurrentToStringUtf8(str);
         }
-        str += "</Features>";
-        str += "</FeatureSet>";
+        BodyEndUtf8(str);
+        ResponseEndUtf8(str);
     }
 }
 
+string MgProxyGwsFeatureReader::GetResponseElementName()
+{
+    return "FeatureSet";
+}
+
+string MgProxyGwsFeatureReader::GetBodyElementName()
+{
+    return "Features";
+}
+
 void MgProxyGwsFeatureReader::ResponseStartUtf8(string& str)
 {
-	str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<FeatureSet>";
+    str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+    str += "<";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyGwsFeatureReader::ResponseEndUtf8(string& str)
 {
-	str += "</FeatureSet>";
+    str += "</";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxyGwsFeatureReader::BodyStartUtf8(string& str)
 {
-	str += "<Features>";
+    str += "<";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyGwsFeatureReader::BodyEndUtf8(string& str)
 {
-	str += "</Features>";
+    str += "</";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxyGwsFeatureReader::HeaderToStringUtf8(string& str)

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxyGwsFeatureReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -462,6 +462,26 @@
 
 INTERNAL_API:
 
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetBodyElementName();
+
 	///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -680,42 +680,54 @@
     CHECKNULL((MgPropertyDefinitionCollection*)m_propDefCol, L"MgProxySqlDataReader.ToXml");
 
     // this XML follows the SqlSelect-1.0.0.xsd schema
-    str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<RowSet>";
-    m_propDefCol->ToColumnDefinitions(str);
-    str += "<Rows>";
+    ResponseStartUtf8(str);
+    HeaderToStringUtf8(str);
+    BodyStartUtf8(str);
     while ( this->ReadNext() )
     {
-        Ptr<MgPropertyCollection> propCol = m_set->GetItem(m_currRecord-1);
-        INT32 cnt = propCol->GetCount();
-        if (propCol != NULL && cnt > 0)
-        {
-            propCol->ToRow(str);
-        }
+        CurrentToStringUtf8(str);
     }
-    str += "</Rows>";
-    str += "</RowSet>";
+    BodyEndUtf8(str);
+    ResponseEndUtf8(str);
 }
 
+string MgProxySqlDataReader::GetResponseElementName()
+{
+    return "RowSet";
+}
+
+string MgProxySqlDataReader::GetBodyElementName()
+{
+    return "Rows";
+}
+
 void MgProxySqlDataReader::ResponseStartUtf8(string& str)
 {
     str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    str += "<RowSet>";
+    str += "<";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxySqlDataReader::ResponseEndUtf8(string& str)
 {
-    str += "</RowSet>";
+    str += "</";
+    str += GetResponseElementName();
+    str += ">";
 }
 
 void MgProxySqlDataReader::BodyStartUtf8(string& str)
 {
-    str += "<Rows>";
+    str += "<";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxySqlDataReader::BodyEndUtf8(string& str)
 {
-    str += "</Rows>";
+    str += "</";
+    str += GetBodyElementName();
+    str += ">";
 }
 
 void MgProxySqlDataReader::HeaderToStringUtf8(string& str)

Modified: sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.h
===================================================================
--- sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/MapGuideCommon/Services/ProxySqlDataReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -487,6 +487,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Common/PlatformBase/Services/Reader.h
===================================================================
--- sandbox/jng/streaming/Common/PlatformBase/Services/Reader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Common/PlatformBase/Services/Reader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -1138,6 +1138,26 @@
 
 INTERNAL_API:
 
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetResponseElementName() = 0;
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    virtual string GetBodyElementName() = 0;
+
 	///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.cpp
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -1512,6 +1512,18 @@
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
+string MgServerDataReader::GetResponseElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerDataReader.GetResponseElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+string MgServerDataReader::GetBodyElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerDataReader.GetBodyElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
 void MgServerDataReader::ResponseStartUtf8(string& str)
 {
     throw new MgInvalidOperationException(L"MgServerDataReader.ResponseStartUtf8",

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.h
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerDataReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -438,6 +438,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.cpp
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -865,6 +865,18 @@
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
+string MgServerFeatureReader::GetResponseElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerFeatureReader.GetResponseElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+string MgServerFeatureReader::GetBodyElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerFeatureReader.GetBodyElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
 void MgServerFeatureReader::ResponseStartUtf8(string& str)
 {
     throw new MgInvalidOperationException(L"MgServerFeatureReader.ResponseStartUtf8",

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.h
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerFeatureReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -403,6 +403,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.cpp
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -1234,6 +1234,18 @@
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
+string MgServerGwsFeatureReader::GetResponseElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerGwsFeatureReader.GetResponseElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+string MgServerGwsFeatureReader::GetBodyElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerGwsFeatureReader.GetBodyElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
 void MgServerGwsFeatureReader::ResponseStartUtf8(string& str)
 {
 	throw new MgInvalidOperationException(L"MgServerGwsFeatureReader.ResponseStartUtf8",

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.h
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerGwsFeatureReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -393,6 +393,26 @@
     /// </summary>
     void Close();
 
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetBodyElementName();
+
 	///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.cpp
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -1352,6 +1352,18 @@
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
+string MgServerSqlDataReader::GetResponseElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerSqlDataReader.GetResponseElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+string MgServerSqlDataReader::GetBodyElementName()
+{
+    throw new MgInvalidOperationException(L"MgServerSqlDataReader.GetBodyElementName",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
 void MgServerSqlDataReader::ResponseStartUtf8(string& str)
 {
     throw new MgInvalidOperationException(L"MgServerSqlDataReader.ResponseStartUtf8",

Modified: sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.h
===================================================================
--- sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Server/src/Services/Feature/ServerSqlDataReader.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -413,6 +413,26 @@
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+	///
+    string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Returns the start of the response as a UTF-8 string. The mime
     /// type must be a text type, for example text/xml.
     ///

Modified: sandbox/jng/streaming/Web/src/ApacheAgent/ApacheAgent.vcxproj
===================================================================
--- sandbox/jng/streaming/Web/src/ApacheAgent/ApacheAgent.vcxproj	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/ApacheAgent/ApacheAgent.vcxproj	2012-12-14 17:41:16 UTC (rev 7270)
@@ -224,6 +224,7 @@
   <ItemGroup>
     <ClCompile Include="ApacheAgent.cpp" />
     <ClCompile Include="ApachePostParser.cpp" />
+    <ClCompile Include="ApacheReaderStreamer.cpp" />
     <ClCompile Include="ApacheResponseHandler.cpp" />
   </ItemGroup>
   <ItemGroup>
@@ -231,6 +232,7 @@
   </ItemGroup>
   <ItemGroup>
     <CustomBuildStep Include="ApachePostParser.h" />
+    <ClInclude Include="ApacheReaderStreamer.h" />
     <ClInclude Include="ApacheResponseHandler.h" />
   </ItemGroup>
   <ItemGroup>

Modified: sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -16,6 +16,7 @@
 //
 
 #include "ApacheResponseHandler.h"
+#include "ApacheReaderStreamer.h"
 #include "MapAgentStrings.h"
 
 #include "httpd.h"
@@ -146,7 +147,8 @@
         }
         else if (outputDataReader != NULL)
         {
-            OutputDataReader(outputDataReader);
+            ApacheReaderStreamer ars(m_r, outputDataReader, result->GetResultContentType());
+            ars.StreamResult();
         }
         else if (outputReader != NULL)
         {
@@ -173,51 +175,6 @@
     MG_CATCH_AND_THROW(L"ApacheResponseHandler.SendResponse");
 }
 
-void ApacheResponseHandler::OutputDataReader(MgReader* reader)
-{
-    MG_TRY()
-
-    m_r->chunked = 1;
-
-    std::string buf;
-    reader->ResponseStartUtf8(buf);
-    reader->HeaderToStringUtf8(buf);
-    reader->BodyStartUtf8(buf);
-
-    WriteChunk(buf.c_str(), buf.length());
-
-    while(reader->ReadNext())
-    {
-        buf.clear();
-        reader->CurrentToStringUtf8(buf);
-        WriteChunk(buf.c_str(), buf.length());
-    }
-
-    buf.clear();
-
-    reader->BodyEndUtf8(buf);
-    reader->ResponseEndUtf8(buf);
-
-    WriteChunk(buf.c_str(), buf.length());
-
-    //Last chunk
-    //ap_rwrite("0\r\n", 3, m_r);
-
-    MG_CATCH_AND_THROW(L"ApacheResponseHandler.OutputDataReader");
-}
-
-void ApacheResponseHandler::WriteChunk(const char* buffer, size_t length)
-{
-    //[chunk size as hex]\r\n
-    //[buffer]\r\n
-    //std::string sizeStr;
-    //MgUtil::Int32ToHexString(length, sizeStr);
-    //sizeStr.append("\r\n");
-    //ap_rwrite(sizeStr.c_str(), sizeStr.length(), m_r);  //[chunk size as hex]\r\n
-    ap_rwrite(buffer, length, m_r);                     //[buffer]
-    //ap_rwrite("\r\n", 2, m_r);                          //\r\n
-}
-
 void ApacheResponseHandler::SendError(MgException *e)
 {
     MG_TRY()

Modified: sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.h
===================================================================
--- sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/ApacheAgent/ApacheResponseHandler.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -36,8 +36,6 @@
     void SendResponse(MgHttpResponse* response);
     void SendError(MgException* e);
     void RequestAuth();
-    void OutputDataReader(MgReader* reader);
-    void WriteChunk(const char* buffer, size_t length);
 
 private:
     request_rec *m_r;

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpExecuteSqlQuery.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpExecuteSqlQuery.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpExecuteSqlQuery.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -63,8 +63,9 @@
 
     // call the C++ API
     Ptr<MgSqlDataReader> sqlReader = service->ExecuteSqlQuery(resId, m_sqlStatement);
-    
-    hResult->SetResultObject(sqlReader, MgMimeType::Xml);
+    //HACK-ish: We're passing conversion responsibility to the caller (agent), so we store the
+    //originally requested format so the caller can determine if conversion is required
+    hResult->SetResultObject(sqlReader, m_responseFormat);
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpExecuteSqlQuery.Execute")
 }

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.h
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.h	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -33,6 +33,7 @@
 // Common HttpHandler headers
 #include "HttpHandlerApiDllExport.h"
 #include "HttpHeader.h"
+#include "HttpReaderStreamer.h"
 #include "HttpRequestParam.h"
 #include "HttpRequestMetadata.h"
 #include "HttpStatusCodes.h"

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj	2012-12-14 17:41:16 UTC (rev 7270)
@@ -306,6 +306,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="HttpReaderStreamer.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="HttpRenameResourceData.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -1018,6 +1024,7 @@
     <ClInclude Include="OgcWfsServer.h" />
     <ClInclude Include="OgcWmsException.h" />
     <ClInclude Include="OgcWmsServer.h" />
+    <ClInclude Include="HttpReaderStreamer.h" />
     <ClInclude Include="ResponseStream.h" />
     <ClInclude Include="Stream.h" />
     <ClInclude Include="StringStream.h" />

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj.filters
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj.filters	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpHandler.vcxproj.filters	2012-12-14 17:41:16 UTC (rev 7270)
@@ -382,6 +382,7 @@
     <ClCompile Include="HttpUtil.cpp" />
     <ClCompile Include="JsonDoc.cpp" />
     <ClCompile Include="XmlJsonConvert.cpp" />
+    <ClCompile Include="HttpReaderStreamer.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="HttpApplyResourcePackage.h">
@@ -752,6 +753,7 @@
     <ClInclude Include="HttpUtil.h" />
     <ClInclude Include="JsonDoc.h" />
     <ClInclude Include="XmlJsonConvert.h" />
+    <ClInclude Include="HttpReaderStreamer.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="HttpHandler.rc" />

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpHandlerBuild.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpHandlerBuild.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpHandlerBuild.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -97,6 +97,7 @@
 #include "HttpMoveResource.cpp"
 #include "HttpPrimitiveValue.cpp"
 #include "HttpQueryMapFeatures.cpp"
+#include "HttpReaderStreamer.cpp"
 #include "HttpRenameResourceData.cpp"
 #include "HttpRequest.cpp"
 #include "HttpRequestMetadata.cpp"

Added: sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.cpp	                        (rev 0)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -0,0 +1,126 @@
+#include "HttpHandler.h"
+#include "XmlJsonConvert.h"
+
+MgHttpReaderStreamer::MgHttpReaderStreamer(MgReader* reader, CREFSTRING format)
+{
+    m_reader = SAFE_ADDREF(reader);
+    m_format = format;
+}
+
+MgHttpReaderStreamer::~MgHttpReaderStreamer() 
+{
+    m_reader = NULL;
+}
+
+void MgHttpReaderStreamer::SetChunkedEncoding() 
+{
+
+}
+
+void MgHttpReaderStreamer::WriteChunk(const char* str, size_t length)
+{
+
+}
+
+void MgHttpReaderStreamer::StreamResult()
+{
+    MG_TRY()
+
+    SetChunkedEncoding();
+
+    if (m_format == MgMimeType::Json)
+    {
+        //MgXmlJsonConvert jsonConvert;
+        std::string buf;
+        std::string jsonbuf;
+
+        //HACK-ish: Split the converted response. Since the XML bits in question are just
+        //start and end tags, this is relatively simple.
+        //
+        //The JSON conversion should look like this:
+        //
+        // <ElementName></ElementName>
+        //
+        //becomes:
+        //
+        // {"ElementName":{}}
+        //
+        //We want to split this so that we have:
+        //
+        // Start - "ElementName":{
+        // End -   }
+
+        //How this looks:
+        //
+        // {"ResponseElementName":
+        //    {<header json>},
+        //  "BodyElementName":[
+        //
+        jsonbuf = "{\"";
+        jsonbuf += m_reader->GetResponseElementName();
+        jsonbuf += "\":";
+        m_reader->HeaderToStringUtf8(buf);
+        std::string jsonbuf2;
+        ToJson(buf, jsonbuf2);
+        jsonbuf += jsonbuf2;
+        jsonbuf += ",\"";
+        jsonbuf += m_reader->GetBodyElementName();
+        jsonbuf += "\":[";
+
+        WriteChunk(jsonbuf.c_str(), jsonbuf.length());
+
+        bool bNext = m_reader->ReadNext();
+        while(bNext)
+        {
+            buf.clear();
+            jsonbuf.clear();
+            m_reader->CurrentToStringUtf8(buf);
+            //The body is a valid full XML element, so no need for gymnastics like its
+            //surrounding elements
+            ToJson(buf, jsonbuf);
+            bNext = m_reader->ReadNext();
+            if (bNext)
+                jsonbuf += ",";
+            WriteChunk(jsonbuf.c_str(), jsonbuf.length());
+        }
+
+        buf.clear();
+        jsonbuf.clear();
+
+        // How this looks:
+        // ]}
+        jsonbuf = "]}";
+        WriteChunk(jsonbuf.c_str(), jsonbuf.length());
+    }
+    else if (m_format == MgMimeType::Xml)
+    {
+        std::string buf;
+        m_reader->ResponseStartUtf8(buf);
+        m_reader->HeaderToStringUtf8(buf);
+        m_reader->BodyStartUtf8(buf);
+
+        WriteChunk(buf.c_str(), buf.length());
+
+        while(m_reader->ReadNext())
+        {
+            buf.clear();
+            m_reader->CurrentToStringUtf8(buf);
+            WriteChunk(buf.c_str(), buf.length());
+        }
+
+        buf.clear();
+
+        m_reader->BodyEndUtf8(buf);
+        m_reader->ResponseEndUtf8(buf);
+
+        WriteChunk(buf.c_str(), buf.length());
+    }
+
+    MG_CATCH_AND_THROW(L"MgHttpReaderStreamer.StreamResult");
+}
+
+void MgHttpReaderStreamer::ToJson(string& xmlString, string& jsonString)
+{
+    MgXmlJsonConvert convert;
+    convert.ToJson(xmlString, jsonString);
+}
\ No newline at end of file

Added: sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.h
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.h	                        (rev 0)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpReaderStreamer.h	2012-12-14 17:41:16 UTC (rev 7270)
@@ -0,0 +1,42 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#ifndef MG_HTTP_READER_STREAMER_H
+#define MG_HTTP_READER_STREAMER_H
+
+/// <summary>
+/// Purpose of this class is to provide a common base class for streaming out the contents of
+/// an MgReader instance via chunked response encoding
+/// </summary>
+class MG_MAPAGENT_API MgHttpReaderStreamer : public MgGuardDisposable
+{
+public:
+    void StreamResult();
+    virtual ~MgHttpReaderStreamer();
+
+protected:
+    MgHttpReaderStreamer(MgReader* reader, CREFSTRING format);
+    virtual void SetChunkedEncoding();
+    virtual void WriteChunk(const char* str, size_t length);
+    virtual void Dispose() { delete this; }
+    
+private:
+    void ToJson(string& xmlString, string& jsonString);
+    Ptr<MgReader> m_reader;
+    STRING m_format;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpRequestResponseHandler.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpRequestResponseHandler.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpRequestResponseHandler.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -277,5 +277,4 @@
         MgXmlJsonConvert convert;
         convert.ToJson(byteReader);
     }
-}
-
+}
\ No newline at end of file

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeatures.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeatures.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeatures.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -104,7 +104,9 @@
     }
 
     Ptr<MgFeatureReader> featureReader = service->SelectFeatures(&resId, m_className, qryOptions);
-    hResult->SetResultObject(featureReader, MgMimeType::Xml);
+    //HACK-ish: We're passing conversion responsibility to the caller (agent), so we store the
+    //originally requested format so the caller can determine if conversion is required
+    hResult->SetResultObject(featureReader, m_responseFormat);
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpSelectFeatures.Execute")
 }

Modified: sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
===================================================================
--- sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2012-12-14 14:32:00 UTC (rev 7269)
+++ sandbox/jng/streaming/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp	2012-12-14 17:41:16 UTC (rev 7270)
@@ -114,7 +114,9 @@
     }
 
     Ptr<MgDataReader> dataReader = service->SelectAggregate(&resId, m_className, qryOptions);
-    hResult->SetResultObject(dataReader, MgMimeType::Xml);
+    //HACK-ish: We're passing conversion responsibility to the caller (agent), so we store the
+    //originally requested format so the caller can determine if conversion is required
+    hResult->SetResultObject(dataReader, m_responseFormat);
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpSelectFeaturesSpatially.Execute")
 }



More information about the mapguide-commits mailing list