Adding support for StopRoutingHandler.

Before this change, the StopRoutingHandler wouldn't work, since the wrapping HttpHandler would invoke the GetHttpHandler on the nested route handler, which in the case of StopRoutingHandler would throw a NotSupportedException.
Maybe a better, more generic way would be to somehow identify which routing handlers should be wrapped and which shouldn't be, maybe based on the result of the GetVirtualPath method on the RouteData object (e.g. if it returns "null", don't wrap).
This commit is contained in:
Sipke Schoorstra
2014-12-01 16:29:46 -08:00
parent aae36c5458
commit a0c3f97cb2

View File

@@ -50,6 +50,11 @@ namespace Orchard.Mvc.Routes {
if (routeData == null)
return null;
// if a StopRoutingHandler was registered, no need to do anything further
if (routeData.RouteHandler is StopRoutingHandler) {
return routeData;
}
// otherwise wrap handler and return it
routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState);
routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;