public IEnumerable<RouteBase> BuildRoute(IServiceFactory factory, SessionStateRequirement defaultSessionRequirement, BehaviorChain chain) { yield return buildRoute(factory, defaultSessionRequirement, chain, chain.Route); foreach (var alias in chain.AdditionalRoutes) { yield return buildRoute(factory, defaultSessionRequirement, chain, alias); } }
public RouteBase BuildRoute(IBehaviorFactory factory, SessionStateRequirement defaultSessionRequirement, BehaviorChain chain) { var requiresSession = chain.Route.SessionStateRequirement ?? defaultSessionRequirement; var route = chain.Route.ToRoute(); var handlerSource = DetermineHandlerSource(requiresSession, chain); var invoker = DetermineInvoker(factory, chain); route.RouteHandler = new FubuRouteHandler(invoker, handlerSource); return route; }
private RouteBase buildRoute(IServiceFactory factory, SessionStateRequirement defaultSessionRequirement, BehaviorChain chain, IRouteDefinition routeDefinition) { var requiresSession = routeDefinition.SessionStateRequirement ?? defaultSessionRequirement; var route = routeDefinition.ToRoute(); var handlerSource = DetermineHandlerSource(requiresSession, chain); var invoker = DetermineInvoker(factory, chain); route.RouteHandler = new FubuRouteHandler(invoker, handlerSource); return route; }
public static IHttpHandlerSource DetermineHandlerSource(SessionStateRequirement sessionStateRequirement, BehaviorChain chain) { if (chain.IsAsynchronous()) { return sessionStateRequirement == SessionStateRequirement.RequiresSessionState ? (IHttpHandlerSource) new AsynchronousHttpHandlerSource() : new SessionlessAsynchronousHttpHandlerSource(); } return sessionStateRequirement == SessionStateRequirement.RequiresSessionState ? (IHttpHandlerSource)new SynchronousHttpHandlerSource() : new SessionlessSynchronousHttpHandlerSource(); }
void DescribesItself.Describe(Description description) { description.Title = "Route: " + Pattern; if (_input != null) { description.Children["Input"] = Description.For(_input); } if (_constraints.Any()) { description.AddList("Constraints", _constraints); } description.Properties["Http Verbs"] = AllowedHttpMethods.Any() ? AllowedHttpMethods.Join(", ") : "Any"; description.Properties["SessionStateRequirement"] = SessionStateRequirement == null ? "Default" : SessionStateRequirement.ToString(); }
public static IHttpHandlerSource DetermineHandlerSource(SessionStateRequirement sessionStateRequirement, BehaviorChain chain) { return(sessionStateRequirement == SessionStateRequirement.RequiresSessionState ? (IHttpHandlerSource) new AsynchronousHttpHandlerSource() : new SessionlessAsynchronousHttpHandlerSource()); }