Exemplo n.º 1
0
        public RouteMatchData Match(IHttpContext httpContext)
        {
            if (false == DoesHttpMethodMatch(httpContext))
            {
                return(null);
            }

            Match match = urlScheme.Match(httpContext.RequestPath);

            if (false == match.Success)
            {
                return(null);
            }

            if (log.IsDebugEnabled)
            {
                log.DebugFormat(
                    "Matched request path '{1}' to URL scheme '{0}'",
                    urlScheme,
                    httpContext.RequestPath);
            }

            RouteMatchData data = new RouteMatchData();

            for (int i = 0; i < match.Groups.Count; i++)
            {
                string groupName = urlScheme.GroupNameFromNumber(i);
                data.AddParameter(groupName, match.Groups[i].Value);
            }

            return(data);
        }
Exemplo n.º 2
0
 public void Initialize(
     IHttpContext httpContext,
     RouteMatchData routeMatchData)
 {
     this.httpContext = httpContext;
     this.routeMatchData = routeMatchData;
 }
Exemplo n.º 3
0
        public RouteMatchData Match(IHttpContext httpContext)
        {
            if (false == DoesHttpMethodMatch(httpContext))
                return null;

            Match match = urlScheme.Match(httpContext.RequestPath);
            if (false == match.Success)
                return null;

            if (log.IsDebugEnabled)
                log.DebugFormat(
                    "Matched request path '{1}' to URL scheme '{0}'",
                    urlScheme,
                    httpContext.RequestPath);

            RouteMatchData data = new RouteMatchData();

            for (int i = 0; i < match.Groups.Count; i++)
            {
                string groupName = urlScheme.GroupNameFromNumber(i);
                data.AddParameter(groupName, match.Groups[i].Value);
            }

            return data;
        }
Exemplo n.º 4
0
 private static IHttpResponse ListPackages(IHttpContext context, RouteMatchData routeMatchData)
 {
     return LiteralHttpResponse.FormatHttpResponse(
         HttpStatusCode.OK,
         HttpConstants.ContentTypeText,
         "list");
 }
Exemplo n.º 5
0
 private static IHttpResponse GetPackage(IHttpContext context, RouteMatchData routeMatchData)
 {
     return LiteralHttpResponse.FormatHttpResponse(
         HttpStatusCode.OK,
         HttpConstants.ContentTypeText,
         "get{0}",
         routeMatchData.GetParameter("id"));
 }
Exemplo n.º 6
0
 public IHttpResponse Handle(IHttpContext context, RouteMatchData routeMatchData)
 {
     return handlerFunc(context, routeMatchData);
 }
Exemplo n.º 7
0
 public IHttpResponse Handle(IHttpContext context, RouteMatchData routeMatchData)
 {
     return(handlerFunc(context, routeMatchData));
 }