/// <summary> /// Convert a matched basic path template (/Controller/Namespace/Name) to /// request Uri /// </summary> /// <param name="match">The match.</param> /// <param name="extraParams">Extra parameters as query parameters.</param> /// <returns></returns> private static Uri BasicPathMatch2ReqUri(UriTemplateMatch match, NameValueCollection extraParams) { // The path qualifies for this operation. Now get the real path. var nsStr = match.BoundVariables[1]; var nameStr = match.BoundVariables[2]; match.QueryParameters.Remove(OnDemandParamName); string queryString = ""; if (match.QueryParameters.Count > 0) { queryString = "?" + UriUtil.JoinNvcToQs(match.QueryParameters); } if (extraParams != null && extraParams.Count > 0) { string qs2 = UriUtil.JoinNvcToQs(extraParams); queryString += (string.IsNullOrEmpty(queryString) ? "?" + qs2 : "&" + qs2); } // BitTorrent/nameSpace/name var reqUri = new Uri(string.Format("/{0}/{1}/{2}", ServerControllerName, nsStr, nameStr) + queryString, UriKind.Relative); // Get the meta info for the path. return(reqUri); }