[mapguide-commits] r5550 - trunk/MgDev/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Feb 15 15:17:07 EST 2011
Author: brucedechant
Date: 2011-02-15 12:17:07 -0800 (Tue, 15 Feb 2011)
New Revision: 5550
Modified:
trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp
Log:
Fix for trac ticket 1599 - Optimize session repository cleanup for WMS requests
http://trac.osgeo.org/mapguide/ticket/1599
Notes:
- Updated session repository cleanup code
- Added error logging call that was missing from custom WMS exception macros
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp 2011-02-15 20:13:23 UTC (rev 5549)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp 2011-02-15 20:17:07 UTC (rev 5550)
@@ -33,6 +33,7 @@
// | | | //
#define CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(mg_exception_type,ogc_exception_code,ogc_server) \
catch (mg_exception_type* e) { \
+ MgHttpUtil::LogException(e); \
STRING sReport = e->GetExceptionMessage(); \
sReport += _("<details>"); \
sReport += e->GetDetails(); \
@@ -47,11 +48,13 @@
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
-// MgOgcWmsException::kpsz... //
-// | OgcServer& //
-// | | //
-#define CATCH_ANYTHING_HANDLE_AS_OGC_WMS(ogc_exception_code,ogc_server) \
+// MgOgcWmsException::kpsz... //
+// | OgcServer& //
+// | | //
+#define CATCH_ANYTHING_HANDLE_AS_OGC_WMS(methodName, ogc_exception_code,ogc_server) \
catch (...) { \
+ Ptr<MgUnclassifiedException> mgException = new MgUnclassifiedException(methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
+ MgHttpUtil::LogException(mgException); \
ogc_server.ServiceExceptionReportResponse( \
MgOgcWmsException(MgOgcWmsException::kpszInternalError, \
_("Unexpected exception was thrown. No additional details available.")));\
@@ -157,6 +160,10 @@
// Create the WMS handler
MgHttpResponseStream responseStream;
MgOgcWmsServer wms(requestParams, responseStream);
+
+ Ptr<MgSite> site;
+ STRING session = L"";
+
try
{
if(wms.ProcessRequest(this))
@@ -174,8 +181,8 @@
// Create session
Ptr<MgUserInformation> userInfo = m_siteConn->GetUserInfo();
- Ptr<MgSite> site = m_siteConn->GetSite();
- STRING session = site->CreateSession();
+ site = m_siteConn->GetSite();
+ session = site->CreateSession();
userInfo->SetMgSessionId(session);
// Get a map object corresponding to the request parameters
@@ -197,9 +204,6 @@
// Set the result
STRING sMimeType = mapImage->GetMimeType();
hResult->SetResultObject(mapImage, sMimeType.length() > 0 ? sMimeType : m_format);
-
- // Destroy the session now that we are done
- site->DestroySession(session);
}
else
{
@@ -216,7 +220,12 @@
CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgInvalidCoordinateSystemException, kpszInvalidCRS, wms)
CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgCoordinateSystemLoadFailedException,kpszInvalidCRS, wms)
CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgException, kpszInternalError,wms)
- CATCH_ANYTHING_HANDLE_AS_OGC_WMS( kpszInternalError,wms)
+ CATCH_ANYTHING_HANDLE_AS_OGC_WMS(L"MgHttpWmsGetMap.Execute", kpszInternalError,wms)
+
+ // Destroy the session now that we are done
+ if((NULL != site.p) && (!session.empty()))
+ site->DestroySession(session);
+
MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpWmsGetMap.Execute")
}
More information about the mapguide-commits
mailing list