[mapguide-commits] r5235 - trunk/MgDev/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Oct 2 05:38:14 EDT 2010
Author: liuar
Date: 2010-10-02 09:38:13 +0000 (Sat, 02 Oct 2010)
New Revision: 5235
Modified:
trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
Log:
Ticket #1421 OGC WFS 1.1.0 Support
15. Following two test cases:[[BR]]
Test wfs:wfs-1.1.0-Basic-GetFeature-tc47.2 (s0002/d1e35145_1/d1e740_1/d1e25225_1/d1e6254_1)
Assertion: IIf a request is unrecognizable or the service cannot process the request, a valid exception report must be returned.
Test wfs:wfs-1.1.0-Basic-GetFeature-tc47.1 (s0002/d1e35145_1/d1e740_1/d1e25225_1/d1e6249_1)
Assertion: IIf a request is unrecognizable or the service cannot process the request, a valid exception report must be returned.
If clients specify invalid feature class or feature property, MapGuide will generate an FDO exception and send it to clients. However, what the client expected is an WFS exception. I wrappered the FDO exception with WFS exception and make sure the client could get the proper error messages.
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2010-10-02 06:25:43 UTC (rev 5234)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp 2010-10-02 09:38:13 UTC (rev 5235)
@@ -23,6 +23,37 @@
#include "OgcFramework.h"
#include "OgcWfsServer.h"
+///////////////////////////////////////////////////////////////////////////////////////////
+// MgException* or derivative //
+// | MgOgcWfsException::kpsz... //
+// | | OgcServer& //
+// | | | //
+#define CATCH_MGEXCEPTION_HANDLE_AS_OGC(mg_exception_type,ogc_exception_code,ogc_server) \
+ catch (mg_exception_type* e) { \
+ STRING sReport = e->GetExceptionMessage(); \
+ ogc_server.ServiceExceptionReportResponse( \
+ MgOgcWfsException(MgOgcWfsException::ogc_exception_code, \
+ sReport.c_str() )); \
+ Ptr<MgByteReader> capabilities = responseStream.Stream().GetReader(); \
+ hResult->SetResultObject(capabilities, capabilities->GetMimeType()); \
+ e->Release(); \
+ } \
+///////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// MgOgcWfsException::kpsz... //
+// | OgcServer& //
+// | | //
+#define CATCH_ANYTHING_HANDLE_AS_OGC(ogc_exception_code,ogc_server) \
+ catch (...) { \
+ ogc_server.ServiceExceptionReportResponse( \
+ MgOgcWfsException(MgOgcWfsException::kpszInternalError, \
+ _("Unexpected exception was thrown. No additional details available.")));\
+ Ptr<MgByteReader> capabilities = responseStream.Stream().GetReader(); \
+ hResult->SetResultObject(capabilities, capabilities->GetMimeType()); \
+ } \
+///////////////////////////////////////////////////////////////////////////////////////////
+
HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpWfsGetFeature)
/// <summary>
@@ -95,14 +126,20 @@
// Create the WFS Server object and respond to the request
MgOgcWfsServer wfsServer(requestParams, responseStream);
- wfsServer.ProcessRequest(this);
- // Obtain the response byte reader
- Ptr<MgByteReader> responseReader = responseStream.Stream().GetReader();
+ try
+ {
+ wfsServer.ProcessRequest(this);
- // Set the result
- hResult->SetResultObject(responseReader, responseReader->GetMimeType());
+ // Obtain the response byte reader
+ Ptr<MgByteReader> responseReader = responseStream.Stream().GetReader();
+ // Set the result
+ hResult->SetResultObject(responseReader, responseReader->GetMimeType());
+ }
+
+ CATCH_MGEXCEPTION_HANDLE_AS_OGC(MgException,kpszInternalError,wfsServer)
+ CATCH_ANYTHING_HANDLE_AS_OGC(pszInternalError,wfsServer)
MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpWfsGetFeature.Execute")
}
Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h 2010-10-02 06:25:43 UTC (rev 5234)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h 2010-10-02 09:38:13 UTC (rev 5235)
@@ -19,6 +19,7 @@
#define _OgcWfsServer_h
#include "OgcServer.h"
+#include "OgcWfsException.h"
#include "WfsFeatureDefinitions.h"
#include "WfsFeatures.h"
More information about the mapguide-commits
mailing list