[mapguide-commits] r9489 - in trunk/MgDev: . Common/MapGuideCommon/System Web/src Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Mar 28 04:13:11 PDT 2019
Author: jng
Date: 2019-03-28 04:13:10 -0700 (Thu, 28 Mar 2019)
New Revision: 9489
Modified:
trunk/MgDev/
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
trunk/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
trunk/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp
trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
trunk/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
trunk/MgDev/Web/src/webconfig.ini
Log:
Merged revision(s) 9483-9484 from branches/3.1/MgDev:
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
........
#2789: Add missing file
........
Index: trunk/MgDev
===================================================================
--- trunk/MgDev 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev 2019-03-28 11:13:10 UTC (rev 9489)
Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
## -1,7 +1,7 ##
/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,9322-9323,9329,9377-9378,9382,9387,9389,9393-9395,9481
+/branches/3.1/MgDev:9026,9058-9059,9067-9068,9322-9323,9329,9377-9378,9382,9387,9389,9393-9395,9481,9483-9484
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2019-03-28 11:13:10 UTC (rev 9489)
@@ -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: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2019-03-28 11:13:10 UTC (rev 9489)
@@ -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: trunk/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Web/src/HttpHandler/HttpQueryMapFeatures.cpp 2019-03-28 11:13:10 UTC (rev 9489)
@@ -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: trunk/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Web/src/HttpHandler/HttpSelectFeatures.cpp 2019-03-28 11:13:10 UTC (rev 9489)
@@ -127,6 +127,10 @@
}
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
Ptr<MgTransform> xform;
if (!m_transformTo.empty())
@@ -134,10 +138,14 @@
STRING schemaName;
STRING className;
MgUtil::ParseQualifiedClassName(m_className, schemaName, className);
-
xform = MgHttpUtil::GetTransform(service, &resId, schemaName, className, m_transformTo);
}
+
ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(featureReader, m_responseFormat, m_bCleanJson, m_bEnablePrecision, m_precision, xform);
+ if (limit > 0)
+ {
+ static_cast<MgReaderByteSourceImpl*>(bsImpl)->SetMaxFeatures(limit);
+ }
Ptr<MgByteSource> byteSource = new MgByteSource(bsImpl);
byteSource->SetMimeType(m_responseFormat);
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2019-03-28 11:13:10 UTC (rev 9489)
@@ -291,6 +291,20 @@
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
+ // in MapGuide web tier uses 0
+
//For GeoJSON, use the new GetWfsReader API
if (sOutputFormat == MgMimeType::Json)
{
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2019-03-28 11:13:10 UTC (rev 9489)
@@ -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;
+ }
+
bool bCaptureGeometry = true;
// Call the C++ API
Modified: trunk/MgDev/Web/src/webconfig.ini
===================================================================
--- trunk/MgDev/Web/src/webconfig.ini 2019-03-27 15:31:27 UTC (rev 9488)
+++ trunk/MgDev/Web/src/webconfig.ini 2019-03-28 11:13:10 UTC (rev 9489)
@@ -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