[mapguide-commits] r8189 - in sandbox/jng/tiling: Common/MapGuideCommon/Services Server/src/Services/Tile

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 9 08:08:22 PDT 2014


Author: jng
Date: 2014-06-09 08:08:22 -0700 (Mon, 09 Jun 2014)
New Revision: 8189

Modified:
   sandbox/jng/tiling/Common/MapGuideCommon/Services/ProxyTileService.cpp
   sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp
   sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp
   sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp
Log:
Fix assorted invalid stream header errors as a result of misunderstanding how data goes across the wire from the web tier to the server tier and some bad copypasta.

Modified: sandbox/jng/tiling/Common/MapGuideCommon/Services/ProxyTileService.cpp
===================================================================
--- sandbox/jng/tiling/Common/MapGuideCommon/Services/ProxyTileService.cpp	2014-06-09 13:12:17 UTC (rev 8188)
+++ sandbox/jng/tiling/Common/MapGuideCommon/Services/ProxyTileService.cpp	2014-06-09 15:08:22 UTC (rev 8189)
@@ -292,7 +292,7 @@
 {
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                      // Connection
-                        MgCommand::knObject,                            // Return type expected
+                        MgCommand::knInt32,                             // Return type expected
                         MgTileServiceOpId::GetDefaultTileSizeX2,        // Command Code
                         1,                                              // No of arguments
                         Tile_Service,                                   // Service Id
@@ -312,7 +312,7 @@
 {
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                      // Connection
-                        MgCommand::knObject,                            // Return type expected
+                        MgCommand::knInt32,                             // Return type expected
                         MgTileServiceOpId::GetDefaultTileSizeY2,        // Command Code
                         1,                                              // No of arguments
                         Tile_Service,                                   // Service Id
@@ -329,7 +329,7 @@
 {
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                      // Connection
-                        MgCommand::knInt32,                             // Return type expected
+                        MgCommand::knObject,                            // Return type expected
                         MgTileServiceOpId::GetTileProviders,            // Command Code
                         0,                                              // No of arguments
                         Tile_Service,                                   // Service Id

Modified: sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp	2014-06-09 13:12:17 UTC (rev 8188)
+++ sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp	2014-06-09 15:08:22 UTC (rev 8189)
@@ -75,10 +75,10 @@
     }
     else if (1 == m_packet.m_NumArguments)
     {
+        Ptr<MgResourceIdentifier> resource = (MgResourceIdentifier*)m_stream->GetObject();
+
         BeginExecution();
 
-        Ptr<MgResourceIdentifier> resource = (MgResourceIdentifier*)m_stream->GetObject();
-
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
         MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();

Modified: sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp	2014-06-09 13:12:17 UTC (rev 8188)
+++ sandbox/jng/tiling/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp	2014-06-09 15:08:22 UTC (rev 8189)
@@ -75,10 +75,10 @@
     }
     else if (1 == m_packet.m_NumArguments)
     {
+        Ptr<MgResourceIdentifier> resource = (MgResourceIdentifier*)m_stream->GetObject();
+
         BeginExecution();
 
-        Ptr<MgResourceIdentifier> resource = (MgResourceIdentifier*)m_stream->GetObject();
-
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
         MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();

Modified: sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp	2014-06-09 13:12:17 UTC (rev 8188)
+++ sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp	2014-06-09 15:08:22 UTC (rev 8189)
@@ -168,48 +168,52 @@
     //we obviously should revisit this.
 
     std::string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-    xml += "<TileProviderList>\n";
-    xml += "\t<TileProvider>\n";
-    xml += "\t\t<Name>";
+    xml.append("<TileProviderList>\n");
+    xml.append("<TileProvider>\n");
+    xml.append("<Name>");
     std::string mbName;
     STRING wName = TILE_PROVIDER_DEFAULT;
     MgUtil::WideCharToMultiByte(wName, mbName);
-    xml += mbName;
-    xml += "</Name>\n";
-    xml += "\t\t<DisplayName>";
+    xml.append(mbName);
+    xml.append("</Name>\n");
+    xml.append("<DisplayName>");
     std::string mbDisplayName;
     STRING wDisplayName = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_DisplayName");
-    xml += mbDisplayName;
-    xml += "</DisplayName>\n";
-    xml += "\t\t<Description>";
+    MgUtil::WideCharToMultiByte(wDisplayName, mbDisplayName);
+    xml.append(mbDisplayName);
+    xml.append("</DisplayName>\n");
+    xml.append("<Description>");
     std::string mbDescription;
     STRING wDescription = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_Description");
-    xml += mbDescription;
-    xml += "</Description>\n";
-    xml += "\t\t<ConnectionProperties>\n";
-    xml += "\t\t\t<ConnectionProperty Enumerable=\"false\" Protected=\"false\" Required=\"true\">\n";
-    xml += "\t\t\t\t<Name>";
+    MgUtil::WideCharToMultiByte(wDescription, mbDescription);
+    xml.append(mbDescription);
+    xml.append("</Description>\n");
+    xml.append("<ConnectionProperties>\n");
+    xml.append("<ConnectionProperty Enumerable=\"false\" Protected=\"false\" Required=\"true\">\n");
+    xml.append("<Name>");
     std::string mbTilePath;
     STRING wTilePath = TILE_PROVIDER_DEFAULT_PARAM_TILEPATH;
     MgUtil::WideCharToMultiByte(wTilePath, mbTilePath);
-    xml += mbTilePath;
-    xml += "</Name>\n";
-    xml += "\t\t\t\t<LocalizedName>";
+    xml.append(mbTilePath);
+    xml.append("</Name>\n");
+    xml.append("<LocalizedName>");
     std::string mbLocName;
     STRING wLocName = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_Property_TilePath_LocalizedName");
     MgUtil::WideCharToMultiByte(wLocName, mbLocName);
-    xml += "</LocalizedName>\n";
-    xml += "\t\t\t\t<DefaultValue>";
+    xml.append(mbLocName);
+    xml.append("</LocalizedName>\n");
+    xml.append("<DefaultValue>");
     std::string mbDefaultTag;
     MgUtil::WideCharToMultiByte(MgResourceTag::TileCachePath, mbDefaultTag);
-    xml += mbDefaultTag;
-    xml += "</DefaultValue>\n";
-    xml += "\t\t\t</ConnectionProperty>\n";
-    xml += "\t\t</ConnectionProperties>\n";
-    xml += "\t</TileProvider>\n";
-    xml += "</TileProviderList>";
+    xml.append(mbDefaultTag);
+    xml.append("</DefaultValue>\n");
+    xml.append("</ConnectionProperty>\n");
+    xml.append("</ConnectionProperties>\n");
+    xml.append("</TileProvider>\n");
+    xml.append("</TileProviderList>");
 
     Ptr<MgByteSource> source = new MgByteSource((BYTE_ARRAY_IN)xml.c_str(), (INT32)xml.length());
+    source->SetMimeType(MgMimeType::Xml);
     ret = source->GetReader();
 
     MG_CATCH_AND_THROW(L"MgServerTileService.GetTileProviders")



More information about the mapguide-commits mailing list