public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            // locate appropriate shell settings for request
            var settings = _runningShellTable.Match(httpContext);

            // only proceed if there was a match, and it was for this client
            if (settings == null || settings.Name != _shellSettings.Name)
                return null;

            var effectiveHttpContext = httpContext;
            if (_urlPrefix != null)
                effectiveHttpContext = new UrlPrefixAdjustedHttpContext(httpContext, _urlPrefix);

            var routeData = _route.GetRouteData(effectiveHttpContext);
            if (routeData == null)
                return null;

            // otherwise wrap handler and return it
            routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState);
            routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;

            if (IsHttpRoute) {
                routeData.Values["IWorkContextAccessor"] = _workContextAccessor; // for WebApi
            }

            return routeData;
        }
Beispiel #2
0
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            // locate appropriate shell settings for request
            var settings = _runningShellTable.Match(httpContext);

            // only proceed if there was a match, and it was for this client
            if (settings == null || settings.Name != _shellSettings.Name)
            {
                return(null);
            }

            var effectiveHttpContext = httpContext;

            if (_urlPrefix != null)
            {
                effectiveHttpContext = new UrlPrefixAdjustedHttpContext(httpContext, _urlPrefix);
            }

            var routeData = _route.GetRouteData(effectiveHttpContext);

            if (routeData == null)
            {
                return(null);
            }

            // otherwise wrap handler and return it
            routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState);
            routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;

            if (IsHttpRoute)
            {
                routeData.Values["IWorkContextAccessor"] = _workContextAccessor; // for WebApi
            }

            return(routeData);
        }