[mapguide-commits] r9681 - in sandbox/jng/ogc_viewer_representation/Web/src: . DevHttpServer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jul 23 08:19:16 PDT 2020


Author: jng
Date: 2020-07-23 08:19:15 -0700 (Thu, 23 Jul 2020)
New Revision: 9681

Added:
   sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/
   sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj
   sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj.filters
   sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp
Modified:
   sandbox/jng/ogc_viewer_representation/Web/src/WebTier.sln
Log:
Add new DevHttpServer project. This uses the cpp-httplib header-only library to implement a simple http server for the purpose of standing up a basic mapagent handler for testing mapagent operations in development without needing to [set up / configure] Apache httpd or IIS for a full blown mapagent handler.

Added: sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj
===================================================================
--- sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj	                        (rev 0)
+++ sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj	2020-07-23 15:19:15 UTC (rev 9681)
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{2f2003c6-d19e-439d-8519-6bfcd7e58e6b}</ProjectGuid>
+    <RootNamespace>DevHttpServer</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\$(Configuration)\DevHttpServer\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\obj\$(Configuration)\DevHttpServer\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\$(Configuration)64\DevHttpServer\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\obj\$(Configuration)64\DevHttpServer\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\$(Configuration)\DevHttpServer\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\obj\$(Configuration)\DevHttpServer\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\$(Configuration)64\DevHttpServer\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\obj\$(Configuration)64\DevHttpServer\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MgDevHttpServerd</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MgDevHttpServerd</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MgDevHttpServer</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MgDevHttpServer</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\Oem\cpp-httplib;..\HttpHandler;..\WebSupport;..\WebApp;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\Oem\jsoncpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_MAPAGENT_API_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>ACEd.lib;lib_jsond.lib;MgMdfParserd.lib;MgMdfModeld.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
+      <AdditionalLibraryDirectories>..\..\..\Oem\ACE\ACE_wrappers\lib\$(Configuration);..\..\..\Oem\dbxml\lib\$(Configuration);..\..\..\Oem\jsoncpp\lib\$(Configuration);..\..\..\common\lib\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>IF NOT EXIST "$(TargetDir)Resources" mkdir "$(TargetDir)Resources"
+echo Copy mapguide_en.res
+xcopy /r /d /y "$(ProjectDir)..\..\..\Common\MapGuideCommon\Resources\mapguide_en.res" "$(TargetDir)Resources"
+echo Copy webconfig.ini
+xcopy /r /d /y "$(SolutionDir)webconfig.ini" "$(TargetDir)"
+echo Copy mapagent test pages
+IF NOT EXIST "$(TargetDir)mapagent" mkdir "$(TargetDir)mapagent"
+xcopy /r /d /y "$(SolutionDir)..\..\UnitTest\WebTier\MapAgent\MapAgentForms\*.*" "$(TargetDir)mapagent"
+echo Copy web tier dlls
+xcopy /r /d /y "$(TargetDir)..\*.dll" "$(TargetDir)"
+echo Copy web tier pdbs
+xcopy /r /d /y "$(TargetDir)..\*.pdb" "$(TargetDir)"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\Oem\cpp-httplib;..\HttpHandler;..\WebSupport;..\WebApp;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\Oem\jsoncpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_MAPAGENT_API_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>ACEd.lib;lib_jsond.lib;MgMdfParserd.lib;MgMdfModeld.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
+      <AdditionalLibraryDirectories>..\..\..\Oem\ACE\ACE_wrappers\lib64\$(Configuration);..\..\..\Oem\dbxml\lib64\$(Configuration);..\..\..\Oem\jsoncpp\lib64\$(Configuration);..\..\..\Common\lib\$(Configuration)64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>IF NOT EXIST "$(TargetDir)Resources" mkdir "$(TargetDir)Resources"
+echo Copy mapguide_en.res
+xcopy /r /d /y "$(ProjectDir)..\..\..\Common\MapGuideCommon\Resources\mapguide_en.res" "$(TargetDir)Resources"
+echo Copy webconfig.ini
+xcopy /r /d /y "$(SolutionDir)webconfig.ini" "$(TargetDir)"
+echo Copy mapagent test pages
+IF NOT EXIST "$(TargetDir)mapagent" mkdir "$(TargetDir)mapagent"
+xcopy /r /d /y "$(SolutionDir)..\..\UnitTest\WebTier\MapAgent\MapAgentForms\*.*" "$(TargetDir)mapagent"
+echo Copy web tier dlls
+xcopy /r /d /y "$(TargetDir)..\*.dll" "$(TargetDir)"
+echo Copy web tier pdbs
+xcopy /r /d /y "$(TargetDir)..\*.pdb" "$(TargetDir)"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\Oem\cpp-httplib;..\HttpHandler;..\WebSupport;..\WebApp;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\Oem\jsoncpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_MAPAGENT_API_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>ACE.lib;lib_json.lib;MgMdfParser.lib;MgMdfModel.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
+      <AdditionalLibraryDirectories>..\..\..\Oem\ACE\ACE_wrappers\lib\$(Configuration);..\..\..\Oem\dbxml\lib\$(Configuration);..\..\..\Oem\jsoncpp\lib\$(Configuration);..\..\..\common\lib\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>IF NOT EXIST "$(TargetDir)Resources" mkdir "$(TargetDir)Resources"
+echo Copy mapguide_en.res
+xcopy /r /d /y "$(ProjectDir)..\..\..\Common\MapGuideCommon\Resources\mapguide_en.res" "$(TargetDir)Resources"
+echo Copy webconfig.ini
+xcopy /r /d /y "$(SolutionDir)webconfig.ini" "$(TargetDir)"
+echo Copy mapagent test pages
+IF NOT EXIST "$(TargetDir)mapagent" mkdir "$(TargetDir)mapagent"
+xcopy /r /d /y "$(SolutionDir)..\..\UnitTest\WebTier\MapAgent\MapAgentForms\*.*" "$(TargetDir)mapagent"
+echo Copy web tier dlls
+xcopy /r /d /y "$(TargetDir)..\*.dll" "$(TargetDir)"
+echo Copy web tier pdbs
+xcopy /r /d /y "$(TargetDir)..\*.pdb" "$(TargetDir)"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\Oem\cpp-httplib;..\HttpHandler;..\WebSupport;..\WebApp;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\Oem\jsoncpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_MAPAGENT_API_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>ACE.lib;lib_json.lib;MgMdfParser.lib;MgMdfModel.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
+      <AdditionalLibraryDirectories>..\..\..\Oem\ACE\ACE_wrappers\lib64\$(Configuration);..\..\..\Oem\dbxml\lib64\$(Configuration);..\..\..\Oem\jsoncpp\lib64\$(Configuration);..\..\..\common\lib\$(Configuration)64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>IF NOT EXIST "$(TargetDir)Resources" mkdir "$(TargetDir)Resources"
+echo Copy mapguide_en.res
+xcopy /r /d /y "$(ProjectDir)..\..\..\Common\MapGuideCommon\Resources\mapguide_en.res" "$(TargetDir)Resources"
+echo Copy webconfig.ini
+xcopy /r /d /y "$(SolutionDir)webconfig.ini" "$(TargetDir)"
+echo Copy mapagent test pages
+IF NOT EXIST "$(TargetDir)mapagent" mkdir "$(TargetDir)mapagent"
+xcopy /r /d /y "$(SolutionDir)..\..\UnitTest\WebTier\MapAgent\MapAgentForms\*.*" "$(TargetDir)mapagent"
+echo Copy web tier dlls
+xcopy /r /d /y "$(TargetDir)..\*.dll" "$(TargetDir)"
+echo Copy web tier pdbs
+xcopy /r /d /y "$(TargetDir)..\*.pdb" "$(TargetDir)"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\Common\Foundation\Foundation.vcxproj">
+      <Project>{a82adc7d-4da4-42f2-9bf6-df5dcfb44425}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\Common\Geometry\Geometry.vcxproj">
+      <Project>{d954daac-e305-40ce-b3f3-c229a0bef4f0}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\Common\MapGuideCommon\MapGuideCommon.vcxproj">
+      <Project>{5287a594-4d4f-43fe-a281-e279ab708cf1}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\Common\PlatformBase\PlatformBase.vcxproj">
+      <Project>{f7334b1b-0efa-47e3-8e66-df158e61b7e4}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\HttpHandler\HttpHandler.vcxproj">
+      <Project>{78619d0e-d3f9-4ddf-b90e-f99cb03dfc44}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\WebApp\WebApp.vcxproj">
+      <Project>{b797917b-6842-467c-8b14-e00b76a91247}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\WebSupport\WebSupport.vcxproj">
+      <Project>{795b1b0e-4ec8-469d-b641-e26324266fbf}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file

Added: sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj.filters
===================================================================
--- sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj.filters	                        (rev 0)
+++ sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/DevHttpServer.vcxproj.filters	2020-07-23 15:19:15 UTC (rev 9681)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file

Added: sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp
===================================================================
--- sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp	                        (rev 0)
+++ sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp	2020-07-23 15:19:15 UTC (rev 9681)
@@ -0,0 +1,383 @@
+//
+//  Copyright (C) 2004-2020 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
+//
+
+#include "httplib.h"
+#include <cstdio>
+#include <string>
+
+// for memory leak detection
+#ifdef _WIN32
+#define _CRTDBG_MAP_ALLOC
+#include <cstdlib>
+#include <crtdbg.h>
+#else
+#include <malloc.h>
+#endif
+
+#include "MapGuideCommon.h"
+#include "HttpHandler.h"
+#include "WebSupport.h"
+#include "Base64.h"
+
+int port = 8000;
+const char* host = "localhost";
+
+void OutputMgReader(httplib::Response& res, MgReader* reader)
+{
+    res.set_chunked_content_provider(
+        [reader](size_t offset, httplib::DataSink& sink) {
+            
+            return true;
+        }
+    );
+}
+
+void OutputByteReader(httplib::Response& res, MgByteReader* outputReader)
+{
+    MgByteReader* br = SAFE_ADDREF(outputReader);
+    std::string sContentType = MgUtil::WideCharToMultiByte(br->GetMimeType());
+    res.set_header("Content-Type", sContentType);
+    res.set_chunked_content_provider(
+        [br](size_t offset, httplib::DataSink& sink) {
+            unsigned char buf[4096];
+            auto nBytes = br->Read(buf, 4096);
+            while (nBytes > 0)
+            {
+                sink.write((char*)buf, nBytes);
+                nBytes = br->Read(buf, 4096);
+            }
+            sink.done();
+            br->Release();
+            return true;
+        }
+    );
+}
+
+void HandleUnauthorized(httplib::Response& res)
+{
+    res.status = 401;
+    res.set_header("WWW-Authenticate", "Basic realm=\"mapguide\"");
+    res.set_content("You must enter a valid login ID and password to access this site", "text/plain");
+}
+
+void HandleMgHttpError(MgHttpResult* result, httplib::Response& res)
+{
+    auto statusMessage = result->GetHttpStatusMessage();
+    //These are 401-class errors
+    if (statusMessage == L"MgAuthenticationFailedException" || statusMessage == L"MgUnauthorizedAccessException")
+    {
+        HandleUnauthorized(res);
+    }
+    else
+    {
+        std::string errHtml = "<html>\n";
+        errHtml += "<head>\n";
+        errHtml += "<title>";
+        errHtml += MgUtil::WideCharToMultiByte(statusMessage);
+        errHtml += "</title>\n";
+        errHtml += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
+        errHtml += "</head>\n";
+        errHtml += "<body>\n";
+        errHtml += "<h2>";
+        errHtml += MgUtil::WideCharToMultiByte(result->GetErrorMessage());
+        errHtml += "</h2>\n";
+        errHtml += "<p>";
+        errHtml += MgUtil::WideCharToMultiByte(result->GetDetailedErrorMessage());
+        errHtml += "</p>\n";
+        errHtml += "</body>\n";
+        errHtml += "</html>";
+
+        res.set_content(errHtml, "text/html");
+    }
+}
+
+void HandleMgException(MgException* ex, httplib::Response& res)
+{
+    std::string content;
+    content += MgUtil::WideCharToMultiByte(ex->GetExceptionMessage());
+    content += "\n";
+    content += MgUtil::WideCharToMultiByte(ex->GetStackTrace());
+    res.set_content(content, "text/plain");
+    if (ex->IsOfClass(PlatformBase_Exception_MgResourceNotFoundException) || ex->IsOfClass(PlatformBase_Exception_MgResourceDataNotFoundException))
+    {
+        res.status = 404;
+    }
+    else if (ex->IsOfClass(MapGuide_Exception_MgAuthenticationFailedException) ||
+        ex->IsOfClass(MapGuide_Exception_MgUnauthorizedAccessException) ||
+        ex->IsOfClass(PlatformBase_Exception_MgUserNotFoundException))
+    {
+        HandleUnauthorized(res);
+    }
+    else
+    {
+        res.status = 500;
+    }
+}
+
+void PopulateGetRequest(MgHttpRequestParam* param, const httplib::Request& req)
+{
+    for (const auto& p : req.params)
+    {
+        STRING key = MgUtil::MultiByteToWideChar(p.first);
+        STRING value = MgUtil::MultiByteToWideChar(p.second);
+        param->AddParameter(key, value);
+    }
+}
+
+void PopulatePostRequest(MgHttpRequestParam* param, const httplib::Request& req)
+{
+    for (const auto& p : req.params)
+    {
+        STRING key = MgUtil::MultiByteToWideChar(p.first);
+        STRING value = MgUtil::MultiByteToWideChar(p.second);
+        param->AddParameter(key, value);
+    }
+
+    //TODO: Handle files
+    for (const auto& f : req.files)
+    {
+        STRING key = MgUtil::MultiByteToWideChar(f.first);
+        
+    }
+}
+
+bool ParseAuthenticationHeader(MgHttpRequestParam* param, const httplib::Request& req)
+{
+    //This method decodes and extracts the username and password from the http authentication
+    //header (if it exists) and packs the values into the MgHttpRequestParam object if they
+    //exist
+    auto authHeader = req.get_header_value("Authorization");
+    if (!authHeader.empty())
+    {
+        //Skip past "Basic "
+        authHeader = authHeader.substr(6);
+        char buffer[256] = { 0 };
+        Base64::Decode((unsigned char*)buffer, authHeader.c_str(), (unsigned long)authHeader.length());
+
+        std::string decoded = buffer;
+        auto cPos = decoded.find(':');
+        if (cPos != std::string::npos)
+        {
+            std::string sUser = decoded.substr(0, cPos);
+            std::string sPass = decoded.substr(cPos + 1);
+
+            STRING username = MgUtil::MultiByteToWideChar(sUser);
+            STRING password = MgUtil::MultiByteToWideChar(sPass);
+
+            param->AddParameter(L"USERNAME", username);
+            param->AddParameter(L"PASSWORD", password);
+            return true;
+        }
+    }
+    return false;
+}
+
+int SendRequest(MgHttpRequest* request, httplib::Response& res)
+{
+    Ptr<MgHttpRequestParam> param = request->GetRequestParam();
+    //This next line does all the grunt work.
+    Ptr<MgHttpResponse> response = request->Execute();
+    Ptr<MgHttpResult> result = response->GetResult();
+    res.status = result->GetStatusCode();
+    if (res.status == 200)
+    {
+        //MgDisposable is MapGuide's "object" class, so we need to do type
+        //testing to find out the underlying derived type. The list of expected
+        //types is small, so there isn't too much of this checking to do
+        Ptr<MgDisposable> resultObj = result->GetResultObject();
+        if (resultObj != nullptr)
+        {
+            std::string contentType = MgUtil::WideCharToMultiByte(result->GetResultContentType());
+
+            auto br = dynamic_cast<MgByteReader*>(resultObj.p);
+            auto rdr = dynamic_cast<MgReader*>(resultObj.p);
+            auto sc = dynamic_cast<MgStringCollection*>(resultObj.p);
+            auto scr = dynamic_cast<MgSpatialContextReader*>(resultObj.p);
+            auto ltr = dynamic_cast<MgLongTransactionReader*>(resultObj.p);
+            auto htp = dynamic_cast<MgHttpPrimitiveValue*>(resultObj.p);
+            if (br != nullptr)
+            {
+                OutputByteReader(res, br);
+            }
+            else if (rdr != nullptr)
+            {
+                OutputMgReader(res, rdr);
+            }
+            else if (sc != nullptr)
+            {
+                Ptr<MgByteReader> byteReader = sc->ToXml();
+                OutputByteReader(res, byteReader);
+            }
+            else if (scr != nullptr)
+            {
+                Ptr<MgByteReader> byteReader = scr->ToXml();
+                OutputByteReader(res, byteReader);
+            }
+            else if (ltr != nullptr)
+            {
+                Ptr<MgByteReader> byteReader = ltr->ToXml();
+                OutputByteReader(res, byteReader);
+            }
+            else if (htp != nullptr)
+            {
+                res.set_content(MgUtil::WideCharToMultiByte(htp->ToString()), contentType.c_str());
+            }
+            else //Shouldn't get here
+            {
+                res.status = 400;
+                std::string errMsg = "Not sure how to output: ";
+                errMsg += resultObj->GetMultiByteClassName();
+                res.set_content(errMsg, contentType.c_str());
+            }
+        }
+    }
+    else
+    {
+        HandleMgHttpError(result, res);
+    }
+    return result->GetStatusCode();
+}
+
+void MapAgentHandler(const httplib::Request& req, httplib::Response& res)
+{
+    bool isGet = req.method == "GET";
+    bool isPost = req.method == "POST";
+    if (!isGet && !isPost)
+    {
+        res.status = 405;
+        res.set_content("Unsupported method: " + req.method, "text/plain");
+        return;
+    }
+
+    std::string sUri = "http://";
+    sUri += host;
+    sUri += ":";
+    sUri += std::to_string(port);
+    sUri += req.path;
+
+    printf("%s %s", req.method.c_str(), req.path.c_str());
+
+    MG_TRY()
+
+    STRING uri = MgUtil::MultiByteToWideChar(sUri);
+
+    //This is the workhorse behind the mapagent handler
+    Ptr<MgHttpRequest> request = new MgHttpRequest(uri);
+
+    //MgHttpRequestParam is the set of key/value parameter pairs that you need to set up for the
+    //MgHttpRequest instance. We extract the relevant parameters from the HttpContext and pass it
+    //down
+    Ptr<MgHttpRequestParam> param = request->GetRequestParam();
+
+    //Extract any parameters from the http authentication header if there is one
+    bool bGotAuth = ParseAuthenticationHeader(param, req);
+
+    if (isGet)
+    {
+        PopulateGetRequest(param, req);
+    }
+    else if (isPost)
+    {
+        PopulatePostRequest(param, req);
+    }
+
+    //A request is valid if it contains any of the following:
+    //
+    // 1. A SESSION parameter
+    // 2. A USERNAME parameter (PASSWORD optional). If not specified the http authentication header is checked and extracted if found
+    //
+    //Whether these values are valid will be determined by MgSiteConnection in the MgHttpRequest handler when we come to execute it
+    bool bValid = param->ContainsParameter(L"SESSION");
+    if (!bValid)
+        bValid = param->ContainsParameter(L"USERNAME");
+
+    if (!bValid)
+    {
+        HandleUnauthorized(res);
+        printf(" - %d\n", 401);
+        return;
+    }
+
+    auto status = SendRequest(request, res);
+
+    printf(" - %d\n", status);
+
+    MG_CATCH(L"MapAgentHandler")
+
+    if (mgException != nullptr)
+    {
+        HandleMgException(mgException, res);
+    }
+}
+
+int main(int argc, char** argv)
+{
+#ifdef _WIN32
+    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+
+#ifdef _DEBUG
+    // to debug memory leaks, set a breakpoint here and set iBlock
+    // to the block allocation you want to break on
+    long iBlock = -1;
+    _CrtSetBreakAlloc(iBlock);
+#endif
+#endif
+
+    putenv("MENTOR_DICTIONARY_PATH=..\\..\\..\\..\\Oem\\CsMap\\CsMapDev\\Dictionaries");
+
+    bool bInit = false;
+    {
+        MG_TRY()
+
+        MgInitializeWebTier(L"webconfig.ini");
+        bInit = true;
+
+        MG_CATCH(L"main")
+
+        if (mgException != nullptr)
+        {
+            STRING msg = mgException->GetExceptionMessage();
+            printf("Error initializing web tier: %S\n", msg.c_str());
+        }
+    }
+
+    httplib::Server server;
+
+    server.set_mount_point("/mapguide/mapagent", "./mapagent");
+
+    server.Post("/mapguide/mapagent/mapagent.fcgi", MapAgentHandler);
+    server.Get("/mapguide/mapagent/mapagent.fcgi", MapAgentHandler);
+
+    printf("Listening on port %d\n", port);
+    server.listen("localhost", port);
+
+    {
+        MG_TRY()
+
+        MgUninitializeWebTier();
+        if (!bInit) //If init failed, ACE::init() will still have been called
+            ACE::fini();
+
+        MG_CATCH(L"main")
+
+        if (mgException != nullptr)
+        {
+            STRING msg = mgException->GetExceptionMessage();
+            printf("Error un-initializing web tier: %S\n", msg.c_str());
+        }
+    }
+}
\ No newline at end of file

Modified: sandbox/jng/ogc_viewer_representation/Web/src/WebTier.sln
===================================================================
--- sandbox/jng/ogc_viewer_representation/Web/src/WebTier.sln	2020-07-23 12:21:21 UTC (rev 9680)
+++ sandbox/jng/ogc_viewer_representation/Web/src/WebTier.sln	2020-07-23 15:19:15 UTC (rev 9681)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.22823.1
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30309.148
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CgiAgent", "CgiAgent\CgiAgent.vcxproj", "{DA3459C2-1430-499F-996F-218DA3DD755D}"
 EndProject
@@ -100,6 +100,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebTestRunner", "WebTestRunner\WebTestRunner.vcxproj", "{1E4F8EE7-3189-4ACE-9103-D69A50B2102F}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevHttpServer", "DevHttpServer\DevHttpServer.vcxproj", "{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -364,6 +366,14 @@
 		{1E4F8EE7-3189-4ACE-9103-D69A50B2102F}.Release|Win32.Build.0 = Release|Win32
 		{1E4F8EE7-3189-4ACE-9103-D69A50B2102F}.Release|x64.ActiveCfg = Release|x64
 		{1E4F8EE7-3189-4ACE-9103-D69A50B2102F}.Release|x64.Build.0 = Release|x64
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Debug|Win32.Build.0 = Debug|Win32
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Debug|x64.ActiveCfg = Debug|x64
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Debug|x64.Build.0 = Debug|x64
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Release|Win32.ActiveCfg = Release|Win32
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Release|Win32.Build.0 = Release|Win32
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Release|x64.ActiveCfg = Release|x64
+		{2F2003C6-D19E-439D-8519-6BFCD7E58E6B}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE



More information about the mapguide-commits mailing list