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;
        }
        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);
            routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;
            return(routeData);
        }
Exemple #3
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);
            }

            // 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, _pipeline);
            routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;

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

            return(routeData);
        }
        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);
            }

            // push provided session state behavior to underlying MvcHandler
            effectiveHttpContext.SetSessionStateBehavior(SessionState);

            // 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);
        }
Exemple #5
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 paint wrap handler and return it
            var containerProvider = new ContainerProvider(_container);
            routeData.RouteHandler = new RouteHandler(containerProvider, routeData.RouteHandler);
            routeData.DataTokens["IContainerProvider"] = containerProvider;
            return routeData;
        }