refactor routing

This commit is contained in:
sgay
2012-07-22 14:01:18 -02:00
parent 533cc91a68
commit 3546b3e954
30 changed files with 408 additions and 251 deletions

View File

@@ -155,7 +155,7 @@ namespace Umbraco.Web.Routing
Trace.TraceInformation("{0}Uri=\"{1}\"", tracePrefix, this.Uri);
// try to find a domain matching the current request
var domainAndUri = Domains.ApplicableDomains(Domain.GetDomains(), RequestContext.Current.UmbracoUrl, false);
var domainAndUri = Domains.ApplicableDomains(Domain.GetDomains(), RoutingContext.UmbracoContext.UmbracoUrl, false);
// handle domain
if (domainAndUri != null)
@@ -199,12 +199,12 @@ namespace Umbraco.Web.Routing
Trace.TraceInformation("{0}Path=\"{1}\"", tracePrefix, this.Uri.AbsolutePath);
// look for the document
// the first successful lookup, if any, will set this.Node, and may also set this.Template
// the first successful resolver, if any, will set this.Node, and may also set this.Template
// some lookups may implement caching
Trace.TraceInformation("{0}Begin lookup", tracePrefix);
var lookups = RoutingContext.RouteLookups.GetLookups();
lookups.Any(lookup => lookup.LookupDocument(this));
Trace.TraceInformation("{0}End lookup, {1}", tracePrefix, (this.HasNode ? "a document was found" : "no document was found"));
Trace.TraceInformation("{0}Begin resolvers", tracePrefix);
var resolvers = RoutingContext.RouteLookups.GetLookups();
resolvers.Any(resolver => resolver.TrySetDocument(this));
Trace.TraceInformation("{0}End resolvers, {1}", tracePrefix, (this.HasNode ? "a document was found" : "no document was found"));
// fixme - not handling umbracoRedirect
// should come after internal redirects
@@ -243,7 +243,7 @@ namespace Umbraco.Web.Routing
Trace.TraceInformation("{0}No document, try notFound lookup", tracePrefix);
// if it fails then give up, there isn't much more that we can do
if (RoutingContext.LookupNotFound == null || !RoutingContext.LookupNotFound.LookupDocument(this))
if (RoutingContext.LookupNotFound == null || !RoutingContext.LookupNotFound.TrySetDocument(this))
{
Trace.TraceInformation("{0}Failed to find a document, give up", tracePrefix);
break;