Permalink
Browse files

Consolidated content route to use request path provider for resolving…

… paths
  • Loading branch information...
1 parent e75c699 commit ca7b77655aaca632bf9de2f0ec642eebe029d351 @libardo libardo committed Sep 4, 2011
@@ -75,6 +75,7 @@ public override void SetUp()
SetupResult.For(engine.Definitions).Return(definitions);
SetupResult.For(engine.UrlParser).Return(parser);
SetupResult.For(engine.Persister).Return(persister);
+ SetupResult.For(engine.Resolve<RequestPathProvider>()).Return(new RequestPathProvider(webContext, parser, new ErrorNotifier(), new HostSection()));
var editUrlManager = new FakeEditUrlManager();
SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
engine.Replay();
@@ -122,9 +122,8 @@ private RouteData GetRouteDataForPath(HttpRequestBase request)
//On a multi-lingual site with separate domains per language,
//the full url (with host) should be passed to UrlParser.ResolvePath():
string host = (request.Url.IsDefaultPort) ? request.Url.Host : request.Url.Authority;
- string hostAndRawUrl = String.Format("{0}://{1}{2}", request.Url.Scheme, host, Url.ToAbsolute(request.AppRelativeCurrentExecutionFilePath));
- Url url = new Url(hostAndRawUrl).RemoveExtension(Url.DefaultExtension);
- PathData td = engine.UrlParser.ResolvePath(url);
+ var url = new Url(request.Url.Scheme, host, request.AppRelativeCurrentExecutionFilePath);
+ PathData td = engine.Resolve<RequestPathProvider>().ResolveUrl(url);
var page = td.CurrentPage;
@@ -66,7 +66,6 @@ protected virtual void Application_BeginRequest(object sender, EventArgs e)
Url.SetToken("{IconsUrl}", Url.ResolveTokens(Url.ManagementUrlToken + "/Resources/icons"));
}
}
-
PathData data = dispatcher.GetCurrentPath();
webContext.CurrentPath = data;
@@ -41,7 +41,6 @@ public RequestPathProvider(IWebContext webContext, IUrlParser parser, IErrorNoti
public virtual PathData GetCurrentPath()
{
Url url = webContext.Url;
- string path = url.Path;
if (!IsRewritable(url))
return PathData.Empty;

0 comments on commit ca7b776

Please sign in to comment.