[mapguide-commits] r9483 - in branches/3.1/MgDev: Common/MapGuideCommon/System Web/src Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Mar 21 07:13:00 PDT 2019
Author: jng
Date: 2019-03-21 07:13:00 -0700 (Thu, 21 Mar 2019)
New Revision: 9483
Modified:
branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj
branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters
branches/3.1/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
branches/3.1/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp
branches/3.1/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
branches/3.1/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
branches/3.1/MgDev/Web/src/webconfig.ini
Log:
Implement global max feature query limits in web tier through new webconfig.ini options:
* GlobalMaxFeatureQueryLimit (for SELECTFEATURES)
* GlobalMaxMapFeatureQueryLimit (for QUERYMAPFEATURES)
* GlobalGetWfsFeaturesLimit (for WFS GETFEATURES)
* GlobalGetWmsFeatureInfoLimit (for WMS GETFEATUREINFO)
Where specified, they will apply a global maximum limit for that operation, taking precedence over whatever operation-specific limit (eg. maxFeatures) that may be specified.
By default these values are not set, resulting in unbounded results as it currently is.
Fixes #2789
Modified: branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2019-03-21 14:13:00 UTC (rev 9483)
@@ -545,6 +545,14 @@
const bool MgConfigProperties::DefaultAgentRequestLogEnabled = false;
const STRING MgConfigProperties::AgentRequestLogFilename = L"RequestLogFilename";
const STRING MgConfigProperties::DefaultAgentRequestLogFilename = L"Request.log";
+const STRING MgConfigProperties::AgentGlobalMaxFeatureQueryLimit = L"GlobalMaxFeatureQueryLimit";
+const INT32 MgConfigProperties::DefaultAgentGlobalMaxFeatureQueryLimit = 0;
+const STRING MgConfigProperties::AgentGlobalMaxMapFeatureQueryLimit = L"GlobalMaxMapFeatureQueryLimit";
+const INT32 MgConfigProperties::DefaultAgentGlobalMaxMapFeatureQueryLimit = 0;
+const STRING MgConfigProperties::AgentGlobalGetWfsFeaturesLimit = L"GlobalGetWfsFeaturesLimit";
+const INT32 MgConfigProperties::DefaultAgentGlobalGetWfsFeaturesLimit = 0;
+const STRING MgConfigProperties::AgentGlobalGetWmsFeatureInfoLimit = L"GlobalGetWmsFeatureInfoLimit";
+const INT32 MgConfigProperties::DefaultAgentGlobalGetWmsFeatureInfoLimit = 0;
// ******************************************************************
// OGC Properties
Modified: branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2019-03-21 14:13:00 UTC (rev 9483)
@@ -954,6 +954,15 @@
static const STRING AgentRequestLogFilename; /// value("RequestLogFilename")
static const STRING DefaultAgentRequestLogFilename; /// value("Request.log")
+ /// Global limit for SELECTFEATURES
+ static const STRING AgentGlobalMaxFeatureQueryLimit; /// value("GlobalMaxFeatureQueryLimit")
+ static const INT32 DefaultAgentGlobalMaxFeatureQueryLimit; /// value(0)
+
+ /// Global limit for QUERYMAPFEATURES
+ static const STRING AgentGlobalMaxMapFeatureQueryLimit; /// value("GlobalMaxMapFeatureQueryLimit")
+ static const INT32 DefaultAgentGlobalMaxMapFeatureQueryLimit; /// value(0)
+
+
/// OGC PROPERTIES SECTION -------------------------------------------------------------------------------------------
/// Ogc properties
@@ -973,6 +982,14 @@
static const STRING CITEWmsEnabled; /// value("CITEWmsEnabled")
static const bool DefaultCITEWmsEnabled; /// value(false)
+ /// Global limit for GetWfsFeatures
+ static const STRING AgentGlobalGetWfsFeaturesLimit; /// value("GlobalGetWfsFeaturesLimit")
+ static const INT32 DefaultAgentGlobalGetWfsFeaturesLimit; /// value(0)
+
+ /// Global limit for GetFeatureInfo
+ static const STRING AgentGlobalGetWmsFeatureInfoLimit; /// value("GlobalGetWmsFeatureInfoLimit")
+ static const INT32 DefaultAgentGlobalGetWmsFeatureInfoLimit; /// value(0)
+
/// WEB APPLICATION PROPERTIES SECTION -------------------------------------------------------------------------------------------
/// Viewer framework properties
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj 2019-03-21 14:13:00 UTC (rev 9483)
@@ -1020,6 +1020,7 @@
<ClInclude Include="HttpWmsGetCapabilities.h" />
<ClInclude Include="HttpWmsGetFeatureInfo.h" />
<ClInclude Include="HttpWmsGetMap.h" />
+ <ClInclude Include="LimitingReader.h" />
<ClInclude Include="NameStringValueCollection.h" />
<ClInclude Include="NameValueCollection.h" />
<ClInclude Include="OgcDataAccessor.h" />
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2019-03-21 14:13:00 UTC (rev 9483)
@@ -757,6 +757,9 @@
<ClInclude Include="HttpDescribeRuntimeMap.h">
<Filter>Mapping Service</Filter>
</ClInclude>
+ <ClInclude Include="LimitingReader.h">
+ <Filter>Feature Service</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HttpHandler.rc" />
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp 2019-03-21 14:13:00 UTC (rev 9483)
@@ -136,6 +136,15 @@
// Call the HTML controller to process the request
MgHtmlController controller(m_siteConn);
Ptr<MgByteReader> featureDescriptionInfo;
+
+ // If global limit specified, it takes precedence
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ INT32 limit = 0;
+ cfg->GetIntValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentGlobalMaxMapFeatureQueryLimit, limit, MgConfigProperties::DefaultAgentGlobalMaxMapFeatureQueryLimit);
+ if (limit > 0)
+ {
+ m_maxFeatures = limit;
+ }
INT32 version = m_userInfo->GetApiVersion();
if (version == MG_API_VERSION(1, 0, 0))
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp 2019-03-21 14:13:00 UTC (rev 9483)
@@ -18,6 +18,7 @@
#include "HttpHandler.h"
#include "HttpSelectFeatures.h"
#include "ReaderByteSourceImpl.h"
+#include "LimitingReader.h"
HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpSelectFeatures)
@@ -109,8 +110,21 @@
}
Ptr<MgFeatureReader> featureReader = service->SelectFeatures(&resId, m_className, qryOptions);
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ INT32 limit = 0;
+ cfg->GetIntValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentGlobalMaxFeatureQueryLimit, limit, MgConfigProperties::DefaultAgentGlobalMaxFeatureQueryLimit);
+
//MgByteSource owns this and will clean it up when done
- ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(featureReader, m_responseFormat);
+ ByteSourceImpl* bsImpl = NULL;
+ if (limit > 0)
+ {
+ Ptr<MgReader> limitReader = new MgLimitingReader(featureReader, limit);
+ bsImpl = new MgReaderByteSourceImpl(limitReader, m_responseFormat);
+ }
+ else
+ {
+ bsImpl = new MgReaderByteSourceImpl(featureReader, m_responseFormat);
+ }
Ptr<MgByteSource> byteSource = new MgByteSource(bsImpl);
byteSource->SetMimeType(m_responseFormat);
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-03-21 14:13:00 UTC (rev 9483)
@@ -291,6 +291,15 @@
sSortCriteria = sSortCriteria.substr(pos+1);
}
+ // If global limit specified, it takes precedence
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ INT32 limit = 0;
+ cfg->GetIntValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::AgentGlobalGetWfsFeaturesLimit, limit, MgConfigProperties::DefaultAgentGlobalGetWfsFeaturesLimit);
+ if (limit > 0)
+ {
+ numFeaturesToRetrieve = limit;
+ }
+
// Call the C++ API
// NOTE: I updated the maxFeatures value from numFeaturesToRetrieve to numFeaturesToRetrieve-1
// Because the MgServerFdoFeatureReader in MapGuide server uses -1 to mark empty, while MgWfsFeatures
Modified: branches/3.1/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
===================================================================
--- branches/3.1/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2019-03-21 14:13:00 UTC (rev 9483)
@@ -154,9 +154,9 @@
Ptr<MgCoordinate> mcsLowerLeft = mcsExtent->GetLowerLeftCoordinate();
Ptr<MgCoordinate> mcsUpperRight = mcsExtent->GetUpperRightCoordinate();
- //When GetFeatureInfo for point or line geometry, simply using click point to query cannot get any matching.
- //Expand selection geometry a little to be a linearRing so that can query point and line.
- double margin = 2;
+ //When GetFeatureInfo for point or line geometry, simply using click point to query cannot get any matching.
+ //Expand selection geometry a little to be a linearRing so that can query point and line.
+ double margin = 2;
// Convert the pixel coords to MCS coords
double mcsMinX = mcsLowerLeft->GetX() + ((double)m_iCoord - margin) * mcsExtent->GetWidth() / map->GetDisplayWidth();
double mcsMaxY = mcsUpperRight->GetY() -((double)m_jCoord - margin) * mcsExtent->GetHeight() / map->GetDisplayHeight();
@@ -229,6 +229,15 @@
// Get the selection geometry
Ptr<MgGeometry> selectionGeometry = GetSelectionGeometry(map);
+ // If global limit specified, it takes precedence
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ INT32 limit = 0;
+ cfg->GetIntValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::AgentGlobalGetWmsFeatureInfoLimit, limit, MgConfigProperties::DefaultAgentGlobalGetWmsFeatureInfoLimit);
+ if (limit > 0)
+ {
+ m_featureCount = limit;
+ }
+
// Call the C++ API
Ptr<MgBatchPropertyCollection> propertyCollection = service->QueryFeatureProperties(map, queryLayers, selectionGeometry,
MgFeatureSpatialOperations::Intersects, L"", m_featureCount, 1 /*Any visible features*/);
Modified: branches/3.1/MgDev/Web/src/webconfig.ini
===================================================================
--- branches/3.1/MgDev/Web/src/webconfig.ini 2019-03-21 12:33:32 UTC (rev 9482)
+++ branches/3.1/MgDev/Web/src/webconfig.ini 2019-03-21 14:13:00 UTC (rev 9483)
@@ -152,6 +152,12 @@
# ErrorLogFilename Name of the log file
# RequestLogEnabled 0 = log disabled, 1 = log enabled
# RequestLogFilename Name of the log file
+# GlobalMaxFeatureQueryLimit If set, and greater than 0, defines a global
+# feature query limit for any operation that
+# returns feature data
+# GlobalMaxMapFeatureQueryLimit If set, and greater than 0, defines a global
+# feature query limit for any operation that
+# returns feature data for a map query
# *****************************************************************************
DebugPause = 0
DisableAuthoring = 0
@@ -161,6 +167,8 @@
ErrorLogFilename = Error.log
RequestLogEnabled = 0
RequestLogFilename = Request.log
+GlobalMaxFeatureQueryLimit =
+GlobalMaxMapFeatureQueryLimit =
[OgcProperties]
# *****************************************************************************
@@ -178,11 +186,19 @@
# CITEWmsEnabled Enable OGC CITE Test for WMS
# Consider unknown requests as OGC Wms HTTP requests
# 0 = false and 1 = true
+# GlobalGetWfsFeaturesLimit If set, and greater than 0, defines a global
+# feature query limit for any GetWfsFeatures
+# operation
+# GlobalGetWmsFeatureInfoLimit If set, and greater than 0, defines a global
+# feature query limit for any GetFeatureInfo
+# operation
# *****************************************************************************
WfsPassword = wfs
WmsPassword = wms
CITEWfsEnabled = 0
CITEWmsEnabled = 0
+GlobalGetWfsFeaturesLimit =
+GlobalGetWmsFeatureInfoLimit =
[WebApplicationProperties]
# *****************************************************************************
More information about the mapguide-commits
mailing list