예제 #1
0
        public void ProcessRequest(String url, RequestParameters parameters, String verb)
        {
            RouteData routeData = RouteTable.Routes.GetRouteData(url);

            if (routeData != null)
            {
                if (ContinueProcessing(url, verb))
                {
                    String controllerName = routeData.GetRequiredString("Controller");
                    IController controller = _controllerFactory.CreateController(controllerName);
                    if (controller != null)
                    {
                        var context = new RequestContext(url, routeData, this, verb);
                        if (parameters != null)
                        {
                            foreach (var item in parameters)
                            {
                                if (context.RouteData.Values.ContainsKey(item.Key))
                                    context.RouteData.Values[item.Key] = item.Value;
                                else
                                    context.RouteData.Values.Add(item.Key, item.Value);
                            }
                        }
                        controller.Execute(context);
                    }
                }
            }
        }
예제 #2
0
        public ControllerContext(IController controller, RequestContext requestContext, RouteData routeData)
        {
            Requires.NotNull(controller, "controller");
            Requires.NotNull(requestContext, "requestContext");
            Requires.NotNull(routeData, "routeData");

            _controller = controller;
            _requestContext = requestContext;
            _routeData = routeData;
        }
예제 #3
0
 public void Execute(RequestContext context)
 {
     _controllerContext = new ControllerContext(this, context, context.RouteData);
     Execute();
 }