public RoutedWebRequest Match(WebRequestData request) { Match match = routeRegex.Match(request.RequestUrl.ToString()); if (false == match.Success) { return(null); } RoutedWebRequest routedWebRequest = new RoutedWebRequest(request, this.webRouteProcessor); for (int i = 0; i < match.Groups.Count; i++) { string propertyName = routeRegex.GroupNameFromNumber(i); string propertyValue = match.Groups[propertyName].Value; routedWebRequest.RouteParameters.Add(propertyName, propertyValue); } return(routedWebRequest); }
public RoutedWebRequest RouteRequest(WebRequestData request) { if (log.IsDebugEnabled) { log.DebugFormat("Routing request URL '{0}'", request.RequestUrl); } foreach (WebRequestRoute route in routes) { RoutedWebRequest routedWebRequest = route.Match(request); if (routedWebRequest != null) { return(routedWebRequest); } } if (log.IsDebugEnabled) { log.DebugFormat("No route found for request URL '{0}'", request.RequestUrl); } return(null); }
public RoutedWebRequest(WebRequestData request, IWebRouteProcessor webRouteProcessor) { this.request = request; this.webRouteProcessor = webRouteProcessor; }
public void ProcessRequest(WebRequestData request, WebResponseData response) { RoutedWebRequest routedRequest = router.RouteRequest(request); routedRequest.Process(response); }