[mapguide-commits] r9148 - in sandbox/jng/clean_json: . UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Apr 18 09:18:26 PDT 2017


Author: jng
Date: 2017-04-18 09:18:26 -0700 (Tue, 18 Apr 2017)
New Revision: 9148

Modified:
   sandbox/jng/clean_json/
   sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getfeaturesetenvelopeform.html
   sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeDrawing.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingLayers.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSectionResources.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSections.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateGroups.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateRepositories.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateUsers.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetFeatureSetEnvelope.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryContent.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryHeader.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteInfo.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteStatus.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteVersion.cpp
   sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetTileProviders.cpp
Log:
Trunk sync


Property changes on: sandbox/jng/clean_json
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/branches/3.1/MgDev:9026,9058-9059,9067-9068
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/simplify:8814-9141
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8818-9143
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/branches/3.1/MgDev:9026,9058-9059,9067-9068
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/simplify:8814-9141
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8818-9147

Modified: sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getfeaturesetenvelopeform.html
===================================================================
--- sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getfeaturesetenvelopeform.html	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getfeaturesetenvelopeform.html	2017-04-18 16:18:26 UTC (rev 9148)
@@ -18,6 +18,13 @@
                 Map name: <input type="text" name="MAPNAME" value="TestMap" size="100" ID="Text4">
             <p>
                 FeatureSet XML: <input type="text" name="FEATURESET" size="100" ID="Text4">
+            <p> Format:
+            <select name="FORMAT">
+            <option value="text/xml">text/xml</option>
+            <option value="application/json">application/json</option>
+            </select>
+            <p>
+            <input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
             </div>
         </form>
     </body>

Modified: sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html
===================================================================
--- sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html	2017-04-18 16:18:26 UTC (rev 9148)
@@ -18,6 +18,11 @@
         <input type="text" name="LOCALE" value="en" size="10" ID="Text4">
         <p> Client Agent:
         <input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+        <p> Format:
+        <select name="FORMAT">
+        <option value="text/xml">text/xml</option>
+        <option value="application/json">application/json</option>
+        </select>
         <p>
         <input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
         </form>

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeDrawing.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeDrawing.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeDrawing.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -61,6 +61,10 @@
 
     // call the C++ API
     Ptr<MgByteReader> byteReaderResult = service->DescribeDrawing(&resId);
+
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpDescribeDrawing.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingLayers.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingLayers.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingLayers.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -63,7 +63,13 @@
 
     // call the C++ API
     Ptr<MgStringCollection> layers = service->EnumerateLayers(&resId, m_sectionName);
-    hResult->SetResultObject(layers, MgMimeType::Xml);
 
+    Ptr<MgByteReader> byteReader = layers->ToXml();
+
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateDrawingLayers.Execute")
 }

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSectionResources.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSectionResources.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSectionResources.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -62,8 +62,12 @@
     Ptr<MgDrawingService> service = (MgDrawingService*)(CreateService(MgServiceType::DrawingService));
 
     // call the C++ API
-    Ptr<MgByteReader> sectionResources = service->EnumerateSectionResources(&resId, m_sectionName);
-    hResult->SetResultObject(sectionResources, MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = service->EnumerateSectionResources(&resId, m_sectionName);
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateDrawingSectionResources.Execute")
 }

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSections.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSections.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateDrawingSections.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -60,8 +60,12 @@
     Ptr<MgDrawingService> service = (MgDrawingService*)(CreateService(MgServiceType::DrawingService));
 
     // call the C++ API
-    Ptr<MgByteReader> sections = service->EnumerateSections(&resId);
-    hResult->SetResultObject(sections, MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = service->EnumerateSections(&resId);
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateDrawingSections.Execute")
 }

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateGroups.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateGroups.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateGroups.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -59,6 +59,9 @@
     // Run API command
     Ptr<MgByteReader> byteReaderResult = mgSite->EnumerateGroups();
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateGroups.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateRepositories.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateRepositories.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateRepositories.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -64,6 +64,9 @@
     // Run API command
     Ptr<MgByteReader> byteReaderResult = mgprService->EnumerateRepositories(m_type);
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateRepositories.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateUsers.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateUsers.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpEnumerateUsers.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -64,6 +64,9 @@
     // Run API command
     Ptr<MgByteReader> byteReaderResult = mgSite->EnumerateUsers( m_group );
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpEnumerateUsers.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetFeatureSetEnvelope.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetFeatureSetEnvelope.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetFeatureSetEnvelope.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -66,7 +66,10 @@
     Ptr<MgEnvelope> envelope = selection->GetExtents(featureService);
     Ptr<MgByteReader> byteReader = envelope->ToXml();
 
-    hResult->SetResultObject(byteReader, MgMimeType::Xml);
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReader);
 
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetFeatureSetEnvelope.Execute")
 }

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryContent.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryContent.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryContent.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -67,6 +67,9 @@
     // Run API command
     Ptr<MgByteReader> byteReaderResult = mgprService->GetRepositoryContent(&mgrIdentifier);
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetRepositoryContent.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryHeader.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryHeader.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetRepositoryHeader.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -67,6 +67,9 @@
     // Run API command
     Ptr<MgByteReader> byteReaderResult = mgprService->GetRepositoryHeader(&mgrIdentifier);
 
+    // Convert to requested response format, if necessary
+    ProcessFormatConversion(byteReaderResult);
+
     hResult->SetResultObject(byteReaderResult, byteReaderResult->GetMimeType());
 
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetRepositoryHeader.Execute")

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteInfo.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteInfo.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteInfo.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -125,12 +125,18 @@
     }
     xml += EndXml();
 
-    Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
-    if(!value)
-        throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
+    std::string mbXml;
+    MgUtil::WideCharToMultiByte(xml, mbXml);
 
-    hResult->SetResultObject(value, MgMimeType::Xml);
+    Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbXml.c_str(), (INT32)mbXml.length());
+    byteSource->SetMimeType(MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = byteSource->GetReader();
 
+    //Convert to alternate response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteInfo.Execute")
 }
 

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteStatus.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteStatus.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteStatus.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -105,12 +105,18 @@
 
     xml += EndXml();
 
-    Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
-    if(!value)
-        throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
+    std::string mbXml;
+    MgUtil::WideCharToMultiByte(xml, mbXml);
 
-    hResult->SetResultObject(value, MgMimeType::Xml);
+    Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbXml.c_str(), (INT32)mbXml.length());
+    byteSource->SetMimeType(MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = byteSource->GetReader();
 
+    //Convert to alternate response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteStatus.Execute")
 }
 

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteVersion.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteVersion.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetSiteVersion.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -117,12 +117,18 @@
     }
     xml += EndXml();
 
-    Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
-    if(!value)
-        throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
+    std::string mbXml;
+    MgUtil::WideCharToMultiByte(xml, mbXml);
 
-    hResult->SetResultObject(value, MgMimeType::Xml);
+    Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbXml.c_str(), (INT32)mbXml.length());
+    byteSource->SetMimeType(MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = byteSource->GetReader();
 
+    //Convert to alternate response format, if necessary
+    ProcessFormatConversion(byteReader);
+
+    hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteVersion.Execute")
 }
 

Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetTileProviders.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetTileProviders.cpp	2017-04-18 16:07:16 UTC (rev 9147)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetTileProviders.cpp	2017-04-18 16:18:26 UTC (rev 9148)
@@ -59,6 +59,9 @@
         // Call the C++ API
         Ptr<MgByteReader> providers = service->GetTileProviders();
 
+        // Convert to requested response format, if necessary
+        ProcessFormatConversion(providers);
+
         // Set the result
         hResult->SetResultObject(providers, providers->GetMimeType());
     }



More information about the mapguide-commits mailing list