//-------------------------------------------- // matches this route. //-------------------------------------------- internal bool Match(Http.ServerRequest serverRequest) { if (string.Equals(serverRequest.Method, this.Method, StringComparison.InvariantCultureIgnoreCase)) { var path = Reactor.Net.HttpUtility.UrlDecode(serverRequest.Url.AbsolutePath); var match = this.regex.IsMatch(path); return(match); } return(false); }
//-------------------------------------------- // computes the params for this route. //-------------------------------------------- internal Dictionary <string, string> ComputeParams(Http.ServerRequest serverRequest) { var dict = new Dictionary <string, string>(); var path = Reactor.Net.HttpUtility.UrlDecode(serverRequest.Url.AbsolutePath); var match = this.regex.Match(path); int index = -1; foreach (var group in match.Groups) { if (index >= 0) { dict[this.names[index]] = group.ToString(); } index++; } return(dict); }