using System; namespace ln.http.router { public class HttpRoutingContext { public HttpRequest HttpRequest { get; } public string Path { get; set; } public string RoutedPath { get; set; } public HttpRoutingContext(HttpRequest httpRequest) : this(httpRequest, httpRequest.URI.AbsolutePath) { } public HttpRoutingContext(HttpRequest httpRequest, string path) { HttpRequest = httpRequest; Path = path; RoutedPath = ""; } HttpRoutingContext(HttpRequest httpRequest,string path,string routedPath) { HttpRequest = httpRequest; Path = path; RoutedPath = routedPath; } public HttpRoutingContext Routed(string residual) { return new HttpRoutingContext(HttpRequest, residual, RoutedPath + Path.Substring(0,Path.Length - residual.Length)); } } }