From ffd14c839baf4993cd58605828b1f234397d0ce6 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 2 Oct 2012 01:40:19 +0500 Subject: [PATCH] After talks with morten and stephane, this renames DocumentRequest -> PublishedContentRequest --- .../Routing/LookupByAliasTests.cs | 2 +- src/Umbraco.Tests/Routing/LookupByIdTests.cs | 2 +- .../LookupByNiceUrlAndTemplateTests.cs | 2 +- .../Routing/LookupByNiceUrlTests.cs | 4 +- .../LookupByNiceUrlWithDomainsTests.cs | 4 +- .../Routing/LookupByPageIdQueryTests.cs | 2 +- .../Routing/RenderRouteHandlerTests.cs | 4 +- .../Routing/UmbracoModuleTests.cs | 14 +- .../Routing/UrlsWithNestedDomains.cs | 2 +- .../Stubs/FakeLastChanceLookup.cs | 2 +- src/Umbraco.Web/Mvc/RenderMvcController.cs | 20 +-- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 26 +-- src/Umbraco.Web/Mvc/RenderViewPage.cs | 6 +- src/Umbraco.Web/Mvc/RouteDefinition.cs | 2 +- src/Umbraco.Web/Mvc/SurfaceController.cs | 2 +- .../Routing/DefaultLastChanceLookup.cs | 8 +- src/Umbraco.Web/Routing/DocumentLookupBase.cs | 4 +- .../Routing/DocumentNotFoundHandler.cs | 2 +- .../Routing/DocumentRequestBuilder.cs | 148 +++++++++--------- .../Routing/IDocumentLastChanceLookup.cs | 8 +- src/Umbraco.Web/Routing/IDocumentLookup.cs | 8 +- src/Umbraco.Web/Routing/LookupByAlias.cs | 6 +- src/Umbraco.Web/Routing/LookupByIdPath.cs | 6 +- src/Umbraco.Web/Routing/LookupByNiceUrl.cs | 10 +- .../Routing/LookupByNiceUrlAndTemplate.cs | 6 +- .../Routing/LookupByPageIdQuery.cs | 2 +- src/Umbraco.Web/Routing/LookupByProfile.cs | 6 +- ...tRequest.cs => PublishedContentRequest.cs} | 6 +- src/Umbraco.Web/Umbraco.Web.csproj | 2 +- src/Umbraco.Web/UmbracoContext.cs | 6 +- src/Umbraco.Web/UmbracoHelper.cs | 8 +- src/Umbraco.Web/UmbracoModule.cs | 4 +- .../umbraco.presentation/default.aspx.cs | 4 +- src/Umbraco.Web/umbraco.presentation/page.cs | 6 +- .../umbraco/uQuery/uQuery-Nodes.cs | 2 +- 35 files changed, 173 insertions(+), 173 deletions(-) rename src/Umbraco.Web/Routing/{DocumentRequest.cs => PublishedContentRequest.cs} (92%) diff --git a/src/Umbraco.Tests/Routing/LookupByAliasTests.cs b/src/Umbraco.Tests/Routing/LookupByAliasTests.cs index 59dad90a68..d5f4777c84 100644 --- a/src/Umbraco.Tests/Routing/LookupByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByAliasTests.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.Routing { var routingContext = GetRoutingContext(urlAsString); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docRequest = new DocumentRequest(url, routingContext); + var docRequest = new PublishedContentRequest(url, routingContext); var lookup = new LookupByAlias(); var result = lookup.TrySetDocument(docRequest); diff --git a/src/Umbraco.Tests/Routing/LookupByIdTests.cs b/src/Umbraco.Tests/Routing/LookupByIdTests.cs index c70088f577..0432c7ac9b 100644 --- a/src/Umbraco.Tests/Routing/LookupByIdTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByIdTests.cs @@ -23,7 +23,7 @@ namespace Umbraco.Tests.Routing { var routingContext = GetRoutingContext(urlAsString); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docRequest = new DocumentRequest(url, routingContext); + var docRequest = new PublishedContentRequest(url, routingContext); var lookup = new LookupByIdPath(); diff --git a/src/Umbraco.Tests/Routing/LookupByNiceUrlAndTemplateTests.cs b/src/Umbraco.Tests/Routing/LookupByNiceUrlAndTemplateTests.cs index f5effa4be5..4b56adcc68 100644 --- a/src/Umbraco.Tests/Routing/LookupByNiceUrlAndTemplateTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByNiceUrlAndTemplateTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests.Routing var altTemplate = Template.MakeNew("blah", new User(0)); var routingContext = GetRoutingContext(urlAsString, template); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docRequest = new DocumentRequest(url, routingContext); + var docRequest = new PublishedContentRequest(url, routingContext); var lookup = new LookupByNiceUrlAndTemplate(); var result = lookup.TrySetDocument(docRequest); diff --git a/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs b/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs index 25150c3599..f5a4408f0d 100644 --- a/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs @@ -35,7 +35,7 @@ namespace Umbraco.Tests.Routing { var routingContext = GetRoutingContext(urlString); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docreq = new DocumentRequest(url, routingContext); + var docreq = new PublishedContentRequest(url, routingContext); var lookup = new LookupByNiceUrl(); ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true"); @@ -62,7 +62,7 @@ namespace Umbraco.Tests.Routing { var routingContext = GetRoutingContext(urlString); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docreq = new DocumentRequest(url, routingContext); + var docreq = new PublishedContentRequest(url, routingContext); var lookup = new LookupByNiceUrl(); var result = lookup.TrySetDocument(docreq); diff --git a/src/Umbraco.Tests/Routing/LookupByNiceUrlWithDomainsTests.cs b/src/Umbraco.Tests/Routing/LookupByNiceUrlWithDomainsTests.cs index 45497f3a48..326198c755 100644 --- a/src/Umbraco.Tests/Routing/LookupByNiceUrlWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByNiceUrlWithDomainsTests.cs @@ -162,7 +162,7 @@ namespace Umbraco.Tests.Routing var routingContext = GetRoutingContext(url); var uri = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docreq = new DocumentRequest(uri, routingContext); + var docreq = new PublishedContentRequest(uri, routingContext); // must lookup domain else lookup by url fails var builder = new DocumentRequestBuilder(docreq); @@ -202,7 +202,7 @@ namespace Umbraco.Tests.Routing var routingContext = GetRoutingContext(url); var uri = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docreq = new DocumentRequest(uri, routingContext); + var docreq = new PublishedContentRequest(uri, routingContext); // must lookup domain else lookup by url fails var builder = new DocumentRequestBuilder(docreq); diff --git a/src/Umbraco.Tests/Routing/LookupByPageIdQueryTests.cs b/src/Umbraco.Tests/Routing/LookupByPageIdQueryTests.cs index 0d3939316a..43a490e2a5 100644 --- a/src/Umbraco.Tests/Routing/LookupByPageIdQueryTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByPageIdQueryTests.cs @@ -27,7 +27,7 @@ namespace Umbraco.Tests.Routing { var routingContext = GetRoutingContext(urlAsString); var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docRequest = new DocumentRequest(url, routingContext); + var docRequest = new PublishedContentRequest(url, routingContext); var lookup = new LookupByPageIdQuery(); //we need to manually stub the return output of HttpContext.Request["umbPageId"] diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs index 91bdee7291..86d7ebb22d 100644 --- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs +++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs @@ -39,7 +39,7 @@ namespace Umbraco.Tests.Routing var route = RouteTable.Routes["Umbraco_default"]; var routeData = new RouteData() { Route = route }; var routingContext = GetRoutingContext("~/dummy-page", template, routeData); - var docRequest = new DocumentRequest(routingContext.UmbracoContext.UmbracoUrl, routingContext) + var docRequest = new PublishedContentRequest(routingContext.UmbracoContext.UmbracoUrl, routingContext) { PublishedContent = routingContext.PublishedContentStore.GetDocumentById(routingContext.UmbracoContext, 1174), Template = template @@ -63,7 +63,7 @@ namespace Umbraco.Tests.Routing var route = RouteTable.Routes["Umbraco_default"]; var routeData = new RouteData() {Route = route}; var routingContext = GetRoutingContext("~/dummy-page", template, routeData); - var docRequest = new DocumentRequest(routingContext.UmbracoContext.UmbracoUrl, routingContext) + var docRequest = new PublishedContentRequest(routingContext.UmbracoContext.UmbracoUrl, routingContext) { PublishedContent = routingContext.PublishedContentStore.GetDocumentById(routingContext.UmbracoContext, 1172), Template = template diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index eeba10fb28..c99da41380 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -133,13 +133,13 @@ namespace Umbraco.Tests.Routing // _module.AssignDocumentRequest(httpContext, umbracoContext, httpContext.Request.Url); - // Assert.IsNotNull(umbracoContext.DocumentRequest); - // Assert.IsNotNull(umbracoContext.DocumentRequest.XmlNode); - // Assert.IsFalse(umbracoContext.DocumentRequest.IsRedirect); - // Assert.IsFalse(umbracoContext.DocumentRequest.Is404); - // Assert.AreEqual(umbracoContext.DocumentRequest.Culture, Thread.CurrentThread.CurrentCulture); - // Assert.AreEqual(umbracoContext.DocumentRequest.Culture, Thread.CurrentThread.CurrentUICulture); - // Assert.AreEqual(nodeId, umbracoContext.DocumentRequest.NodeId); + // Assert.IsNotNull(umbracoContext.PublishedContentRequest); + // Assert.IsNotNull(umbracoContext.PublishedContentRequest.XmlNode); + // Assert.IsFalse(umbracoContext.PublishedContentRequest.IsRedirect); + // Assert.IsFalse(umbracoContext.PublishedContentRequest.Is404); + // Assert.AreEqual(umbracoContext.PublishedContentRequest.Culture, Thread.CurrentThread.CurrentCulture); + // Assert.AreEqual(umbracoContext.PublishedContentRequest.Culture, Thread.CurrentThread.CurrentUICulture); + // Assert.AreEqual(nodeId, umbracoContext.PublishedContentRequest.NodeId); //} diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 55d2986ab3..d5d0194e52 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -43,7 +43,7 @@ namespace Umbraco.Tests.Routing // route a rogue url url = "http://domain1.com/1001-1/1001-1-1"; var uri = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url - var docreq = new DocumentRequest(uri, routingContext); + var docreq = new PublishedContentRequest(uri, routingContext); var builder = new DocumentRequestBuilder(docreq); builder.LookupDomain(); Assert.IsTrue(docreq.HasDomain); diff --git a/src/Umbraco.Tests/Stubs/FakeLastChanceLookup.cs b/src/Umbraco.Tests/Stubs/FakeLastChanceLookup.cs index 75b2aa777b..55247b8984 100644 --- a/src/Umbraco.Tests/Stubs/FakeLastChanceLookup.cs +++ b/src/Umbraco.Tests/Stubs/FakeLastChanceLookup.cs @@ -4,7 +4,7 @@ namespace Umbraco.Tests.Stubs { internal class FakeLastChanceLookup : IDocumentLastChanceLookup { - public bool TrySetDocument(DocumentRequest docRequest) + public bool TrySetDocument(PublishedContentRequest docRequest) { return false; } diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs index 5c16886106..addbaf3a84 100644 --- a/src/Umbraco.Web/Mvc/RenderMvcController.cs +++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs @@ -14,32 +14,32 @@ namespace Umbraco.Web.Mvc ActionInvoker = new RenderActionInvoker(); } - private DocumentRequest _documentRequest; + private PublishedContentRequest _publishedContentRequest; /// /// Returns the current UmbracoContext /// protected UmbracoContext UmbracoContext { - get { return DocumentRequest.RoutingContext.UmbracoContext; } + get { return PublishedContentRequest.RoutingContext.UmbracoContext; } } - //TODO: make this protected once we make DocumentRequest not internal after we figure out what it should actually contain + //TODO: make this protected once we make PublishedContentRequest not internal after we figure out what it should actually contain /// - /// Returns the current DocumentRequest + /// Returns the current PublishedContentRequest /// - internal DocumentRequest DocumentRequest + internal PublishedContentRequest PublishedContentRequest { get { - if (_documentRequest != null) - return _documentRequest; + if (_publishedContentRequest != null) + return _publishedContentRequest; if (!RouteData.DataTokens.ContainsKey("umbraco-doc-request")) { - throw new InvalidOperationException("DataTokens must contain an 'umbraco-doc-request' key with a DocumentRequest object"); + throw new InvalidOperationException("DataTokens must contain an 'umbraco-doc-request' key with a PublishedContentRequest object"); } - _documentRequest = (DocumentRequest) RouteData.DataTokens["umbraco-doc-request"]; - return _documentRequest; + _publishedContentRequest = (PublishedContentRequest) RouteData.DataTokens["umbraco-doc-request"]; + return _publishedContentRequest; } } diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 66b1c8e391..ab50da9543 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -36,10 +36,10 @@ namespace Umbraco.Web.Mvc { throw new NullReferenceException("There is not current UmbracoContext, it must be initialized before the RenderRouteHandler executes"); } - var docRequest = UmbracoContext.Current.DocumentRequest; + var docRequest = UmbracoContext.Current.PublishedContentRequest; if (docRequest == null) { - throw new NullReferenceException("There is not current DocumentRequest, it must be initialized before the RenderRouteHandler executes"); + throw new NullReferenceException("There is not current PublishedContentRequest, it must be initialized before the RenderRouteHandler executes"); } var renderModel = new RenderModel() @@ -167,9 +167,9 @@ namespace Umbraco.Web.Mvc /// Returns a RouteDefinition object based on the current renderModel /// /// - /// + /// /// - internal virtual RouteDefinition GetUmbracoRouteDefinition(RequestContext requestContext, DocumentRequest documentRequest) + internal virtual RouteDefinition GetUmbracoRouteDefinition(RequestContext requestContext, PublishedContentRequest publishedContentRequest) { var defaultControllerName = ControllerExtensions.GetControllerName(); //creates the default route definition which maps to the 'UmbracoController' controller @@ -177,13 +177,13 @@ namespace Umbraco.Web.Mvc { ControllerName = defaultControllerName, Controller = new RenderMvcController(), - DocumentRequest = documentRequest, + PublishedContentRequest = publishedContentRequest, ActionName = ((Route)requestContext.RouteData.Route).Defaults["action"].ToString(), HasHijackedRoute = false }; //check if there's a custom controller assigned, base on the document type alias. - var controller = _controllerFactory.CreateController(requestContext, documentRequest.PublishedContent.DocumentTypeAlias); + var controller = _controllerFactory.CreateController(requestContext, publishedContentRequest.PublishedContent.DocumentTypeAlias); //check if that controller exists @@ -203,18 +203,18 @@ namespace Umbraco.Web.Mvc } else { - LogHelper.Warn("The current Document Type {0} matches a locally declared controller of type {1}. Custom Controllers for Umbraco routing must inherit from '{2}'.", documentRequest.PublishedContent.DocumentTypeAlias, controller.GetType().FullName, typeof(RenderMvcController).FullName); + LogHelper.Warn("The current Document Type {0} matches a locally declared controller of type {1}. Custom Controllers for Umbraco routing must inherit from '{2}'.", publishedContentRequest.PublishedContent.DocumentTypeAlias, controller.GetType().FullName, typeof(RenderMvcController).FullName); //exit as we cannnot route to the custom controller, just route to the standard one. return def; } //check that a template is defined), if it doesn't and there is a hijacked route it will just route // to the index Action - if (documentRequest.HasTemplate) + if (publishedContentRequest.HasTemplate) { //check if the custom controller has an action with the same name as the template name (we convert ToUmbracoAlias since the template name might have invalid chars). //NOTE: This also means that all custom actions MUST be PascalCase.. but that should be standard. - var templateName = documentRequest.Template.Alias.Split('.')[0].ToUmbracoAlias(StringAliasCaseType.PascalCase); + var templateName = publishedContentRequest.Template.Alias.Split('.')[0].ToUmbracoAlias(StringAliasCaseType.PascalCase); def.ActionName = templateName; } @@ -228,10 +228,10 @@ namespace Umbraco.Web.Mvc /// this will determine the controller and set the values in the route data /// /// - /// - internal IHttpHandler GetHandlerForRoute(RequestContext requestContext, DocumentRequest documentRequest) + /// + internal IHttpHandler GetHandlerForRoute(RequestContext requestContext, PublishedContentRequest publishedContentRequest) { - var routeDef = GetUmbracoRouteDefinition(requestContext, documentRequest); + var routeDef = GetUmbracoRouteDefinition(requestContext, publishedContentRequest); //Need to check for a special case if there is form data being posted back to an Umbraco URL var postedInfo = GetPostedFormInfo(requestContext); @@ -242,7 +242,7 @@ namespace Umbraco.Web.Mvc //here we need to check if there is no hijacked route and no template assigned, if this is the case //we want to return a blank page, but we'll leave that up to the NoTemplateHandler. - if (!documentRequest.HasTemplate && !routeDef.HasHijackedRoute) + if (!publishedContentRequest.HasTemplate && !routeDef.HasHijackedRoute) { return new NoTemplateHandler(); } diff --git a/src/Umbraco.Web/Mvc/RenderViewPage.cs b/src/Umbraco.Web/Mvc/RenderViewPage.cs index 5149d6bcde..0128220a7b 100644 --- a/src/Umbraco.Web/Mvc/RenderViewPage.cs +++ b/src/Umbraco.Web/Mvc/RenderViewPage.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Mvc var dynamicNode = new DynamicPublishedContent(Model.CurrentContent); CurrentPage = dynamicNode.AsDynamic(); } - DocumentRequest = (DocumentRequest)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-doc-request"); + PublishedContentRequest = (PublishedContentRequest)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-doc-request"); UmbracoContext = (UmbracoContext)ViewContext.RouteData.DataTokens.GetRequiredObject("umbraco-context"); ApplicationContext = UmbracoContext.Application; } @@ -42,9 +42,9 @@ namespace Umbraco.Web.Mvc public ApplicationContext ApplicationContext { get; private set; } /// - /// Returns the current DocumentRequest + /// Returns the current PublishedContentRequest /// - internal DocumentRequest DocumentRequest { get; private set; } + internal PublishedContentRequest PublishedContentRequest { get; private set; } /// /// Returns the a DynamicPublishedContent object diff --git a/src/Umbraco.Web/Mvc/RouteDefinition.cs b/src/Umbraco.Web/Mvc/RouteDefinition.cs index 997815db0b..e9b7ffe378 100644 --- a/src/Umbraco.Web/Mvc/RouteDefinition.cs +++ b/src/Umbraco.Web/Mvc/RouteDefinition.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.Mvc /// /// The current RenderModel found for the request /// - public DocumentRequest DocumentRequest { get; set; } + public PublishedContentRequest PublishedContentRequest { get; set; } /// /// Gets/sets whether the current request has a hijacked route/user controller routed for it diff --git a/src/Umbraco.Web/Mvc/SurfaceController.cs b/src/Umbraco.Web/Mvc/SurfaceController.cs index dd2ae2c601..baa4bfd920 100644 --- a/src/Umbraco.Web/Mvc/SurfaceController.cs +++ b/src/Umbraco.Web/Mvc/SurfaceController.cs @@ -109,7 +109,7 @@ namespace Umbraco.Web.Mvc throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name + " in the context of an Http POST when using the BeginUmbracoForm helper"); var routeDef = (RouteDefinition)ControllerContext.RouteData.DataTokens["umbraco-route-def"]; - return routeDef.DocumentRequest.PublishedContent; + return routeDef.PublishedContentRequest.PublishedContent; } } diff --git a/src/Umbraco.Web/Routing/DefaultLastChanceLookup.cs b/src/Umbraco.Web/Routing/DefaultLastChanceLookup.cs index cef71596fe..4c9b4fa103 100644 --- a/src/Umbraco.Web/Routing/DefaultLastChanceLookup.cs +++ b/src/Umbraco.Web/Routing/DefaultLastChanceLookup.cs @@ -32,11 +32,11 @@ namespace Umbraco.Web.Routing // want, then make it the default one, then remove this one. /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. - public bool TrySetDocument(DocumentRequest docRequest) + public bool TrySetDocument(PublishedContentRequest docRequest) { docRequest.PublishedContent = HandlePageNotFound(docRequest); return docRequest.HasNode; @@ -46,7 +46,7 @@ namespace Umbraco.Web.Routing //FIXME: this is temporary and should be obsoleted - IPublishedContent HandlePageNotFound(DocumentRequest docRequest) + IPublishedContent HandlePageNotFound(PublishedContentRequest docRequest) { LogHelper.Debug("Running for url='{0}'.", () => docRequest.Uri.AbsolutePath); diff --git a/src/Umbraco.Web/Routing/DocumentLookupBase.cs b/src/Umbraco.Web/Routing/DocumentLookupBase.cs index 5276d7ffb9..082b990be1 100644 --- a/src/Umbraco.Web/Routing/DocumentLookupBase.cs +++ b/src/Umbraco.Web/Routing/DocumentLookupBase.cs @@ -7,7 +7,7 @@ namespace Umbraco.Web.Routing ///// //internal abstract class DocumentLookupBase : IDocumentLookup //{ - // public bool TrySetDocument(DocumentRequest docRequest) + // public bool TrySetDocument(PublishedContentRequest docRequest) // { // if (docRequest == null) throw new ArgumentNullException("docRequest"); // if (docRequest.RoutingContext == null) throw new ArgumentNullException("docRequest.RoutingContext"); @@ -16,6 +16,6 @@ namespace Umbraco.Web.Routing // return TrySetDocument(docRequest, docRequest.RoutingContext, docRequest.UmbracoContext); // } - // protected abstract bool TrySetDocument(DocumentRequest docRequest, RoutingContext routingContext, UmbracoContext umbracoContext); + // protected abstract bool TrySetDocument(PublishedContentRequest docRequest, RoutingContext routingContext, UmbracoContext umbracoContext); //} } \ No newline at end of file diff --git a/src/Umbraco.Web/Routing/DocumentNotFoundHandler.cs b/src/Umbraco.Web/Routing/DocumentNotFoundHandler.cs index 45c38d334c..2e86960946 100644 --- a/src/Umbraco.Web/Routing/DocumentNotFoundHandler.cs +++ b/src/Umbraco.Web/Routing/DocumentNotFoundHandler.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Routing response.Clear(); - var docreq = UmbracoContext.Current.DocumentRequest; + var docreq = UmbracoContext.Current.PublishedContentRequest; var reason = "Cannot render the page at url '{0}'."; if (!docreq.HasNode) reason = "No umbraco document matches the url '{0}'."; diff --git a/src/Umbraco.Web/Routing/DocumentRequestBuilder.cs b/src/Umbraco.Web/Routing/DocumentRequestBuilder.cs index 333a96bcdd..83fd3f8e3a 100644 --- a/src/Umbraco.Web/Routing/DocumentRequestBuilder.cs +++ b/src/Umbraco.Web/Routing/DocumentRequestBuilder.cs @@ -13,23 +13,23 @@ using umbraco.cms.businesslogic.web; namespace Umbraco.Web.Routing { /// - /// Looks up the document using ILookup's and sets any additional properties required on the DocumentRequest object + /// Looks up the document using ILookup's and sets any additional properties required on the PublishedContentRequest object /// internal class DocumentRequestBuilder { - private readonly DocumentRequest _documentRequest; + private readonly PublishedContentRequest _publishedContentRequest; private readonly UmbracoContext _umbracoContext; private readonly RoutingContext _routingContext; - public DocumentRequestBuilder(DocumentRequest documentRequest) + public DocumentRequestBuilder(PublishedContentRequest publishedContentRequest) { - _documentRequest = documentRequest; - _umbracoContext = documentRequest.RoutingContext.UmbracoContext; - _routingContext = documentRequest.RoutingContext; + _publishedContentRequest = publishedContentRequest; + _umbracoContext = publishedContentRequest.RoutingContext.UmbracoContext; + _routingContext = publishedContentRequest.RoutingContext; } /// - /// Determines the rendering engine to use and sets the flag on the DocumentRequest + /// Determines the rendering engine to use and sets the flag on the PublishedContentRequest /// internal void DetermineRenderingEngine() { @@ -37,13 +37,13 @@ namespace Umbraco.Web.Routing //sometimes don't require a template since the developer may want full control over the rendering. //Webforms doesn't support this so MVC it is. MVC will also handle what to do if no template or hijacked route //is there (i.e. blank page) - if (!_documentRequest.HasTemplate) + if (!_publishedContentRequest.HasTemplate) { - _documentRequest.RenderingEngine = RenderingEngine.Mvc; + _publishedContentRequest.RenderingEngine = RenderingEngine.Mvc; return; } - var templateAlias = _documentRequest.Template.Alias; + var templateAlias = _publishedContentRequest.Template.Alias; Func determineEngine = (directory, alias, extensions, renderingEngine) => @@ -57,7 +57,7 @@ namespace Umbraco.Web.Routing if (file != null) { //it is mvc since we have a template there that exists with this alias - _documentRequest.RenderingEngine = renderingEngine; + _publishedContentRequest.RenderingEngine = renderingEngine; return true; } return false; @@ -92,7 +92,7 @@ namespace Umbraco.Web.Routing // note - we are not handling schemes nor ports here. - LogHelper.Debug("{0}Uri=\"{1}\"", () => tracePrefix, () => _documentRequest.Uri); + LogHelper.Debug("{0}Uri=\"{1}\"", () => tracePrefix, () => _publishedContentRequest.Uri); // try to find a domain matching the current request var domainAndUri = DomainHelper.DomainMatch(Domain.GetDomains(), _umbracoContext.UmbracoUrl, false); @@ -101,15 +101,15 @@ namespace Umbraco.Web.Routing if (domainAndUri != null) { // matching an existing domain - LogHelper.Debug("{0}Matches domain=\"{1}\", rootId={2}, culture=\"{3}\"", + LogHelper.Debug("{0}Matches domain=\"{1}\", rootId={2}, culture=\"{3}\"", () => tracePrefix, () => domainAndUri.Domain.Name, () => domainAndUri.Domain.RootNodeId, () => domainAndUri.Domain.Language.CultureAlias); - _documentRequest.Domain = domainAndUri.Domain; - _documentRequest.DomainUri = domainAndUri.Uri; - _documentRequest.Culture = new CultureInfo(domainAndUri.Domain.Language.CultureAlias); + _publishedContentRequest.Domain = domainAndUri.Domain; + _publishedContentRequest.DomainUri = domainAndUri.Uri; + _publishedContentRequest.Culture = new CultureInfo(domainAndUri.Domain.Language.CultureAlias); // canonical? not implemented at the moment // if (...) @@ -121,15 +121,15 @@ namespace Umbraco.Web.Routing else { // not matching any existing domain - LogHelper.Debug("{0}Matches no domain", () => tracePrefix); + LogHelper.Debug("{0}Matches no domain", () => tracePrefix); var defaultLanguage = Language.GetAllAsList().FirstOrDefault(); - _documentRequest.Culture = defaultLanguage == null ? CultureInfo.CurrentUICulture : new CultureInfo(defaultLanguage.CultureAlias); + _publishedContentRequest.Culture = defaultLanguage == null ? CultureInfo.CurrentUICulture : new CultureInfo(defaultLanguage.CultureAlias); } - LogHelper.Debug("{0}Culture=\"{1}\"", () => tracePrefix, () => _documentRequest.Culture.Name); + LogHelper.Debug("{0}Culture=\"{1}\"", () => tracePrefix, () => _publishedContentRequest.Culture.Name); - return _documentRequest.Domain != null; + return _publishedContentRequest.Domain != null; } /// @@ -139,7 +139,7 @@ namespace Umbraco.Web.Routing internal bool LookupDocument() { const string tracePrefix = "LookupDocument: "; - LogHelper.Debug("{0}Path=\"{1}\"", () => tracePrefix, () => _documentRequest.Uri.AbsolutePath); + LogHelper.Debug("{0}Path=\"{1}\"", () => tracePrefix, () => _publishedContentRequest.Uri.AbsolutePath); // look for the document // the first successful resolver, if any, will set this.Node, and may also set this.Template @@ -147,9 +147,9 @@ namespace Umbraco.Web.Routing using (DisposableTimer.DebugDuration( string.Format("{0}Begin resolvers", tracePrefix), - string.Format("{0}End resolvers, {1}", tracePrefix, (_documentRequest.HasNode ? "a document was found" : "no document was found")))) + string.Format("{0}End resolvers, {1}", tracePrefix, (_publishedContentRequest.HasNode ? "a document was found" : "no document was found")))) { - _routingContext.DocumentLookups.Any(lookup => lookup.TrySetDocument(_documentRequest)); + _routingContext.DocumentLookups.Any(lookup => lookup.TrySetDocument(_publishedContentRequest)); } // fixme - not handling umbracoRedirect @@ -162,7 +162,7 @@ namespace Umbraco.Web.Routing // handle umbracoRedirect (moved from umbraco.page) FollowRedirect(); - bool resolved = _documentRequest.HasNode && _documentRequest.HasTemplate; + bool resolved = _publishedContentRequest.HasNode && _publishedContentRequest.HasTemplate; return resolved; } @@ -180,23 +180,23 @@ namespace Umbraco.Web.Routing const int maxLoop = 12; do { - LogHelper.Debug("{0}{1}", () => tracePrefix, () => (i == 0 ? "Begin" : "Loop")); + LogHelper.Debug("{0}{1}", () => tracePrefix, () => (i == 0 ? "Begin" : "Loop")); // handle not found - if (!_documentRequest.HasNode) + if (!_publishedContentRequest.HasNode) { - _documentRequest.Is404 = true; - LogHelper.Debug("{0}No document, try last chance lookup", () => tracePrefix); + _publishedContentRequest.Is404 = true; + LogHelper.Debug("{0}No document, try last chance lookup", () => tracePrefix); // if it fails then give up, there isn't much more that we can do var lastChance = _routingContext.DocumentLastChanceLookup; - if (lastChance == null || !lastChance.TrySetDocument(_documentRequest)) + if (lastChance == null || !lastChance.TrySetDocument(_publishedContentRequest)) { - LogHelper.Debug("{0}Failed to find a document, give up", () => tracePrefix); + LogHelper.Debug("{0}Failed to find a document, give up", () => tracePrefix); break; } - LogHelper.Debug("{0}Found a document", () => tracePrefix); + LogHelper.Debug("{0}Found a document", () => tracePrefix); } // follow internal redirects as long as it's not running out of control ie infinite loop of some sort @@ -206,25 +206,25 @@ namespace Umbraco.Web.Routing break; // ensure access - if (_documentRequest.HasNode) + if (_publishedContentRequest.HasNode) EnsureNodeAccess(); // resolve template - if (_documentRequest.HasNode) + if (_publishedContentRequest.HasNode) LookupTemplate(); // loop while we don't have page, ie the redirect or access // got us to nowhere and now we need to run the notFoundLookup again // as long as it's not running out of control ie infinite loop of some sort - } while (!_documentRequest.HasNode && i++ < maxLoop); + } while (!_publishedContentRequest.HasNode && i++ < maxLoop); if (i == maxLoop || j == maxLoop) { - LogHelper.Debug("{0}Looks like we're running into an infinite loop, abort", () => tracePrefix); - _documentRequest.PublishedContent = null; + LogHelper.Debug("{0}Looks like we're running into an infinite loop, abort", () => tracePrefix); + _publishedContentRequest.PublishedContent = null; } - LogHelper.Debug("{0}End", () => tracePrefix); + LogHelper.Debug("{0}End", () => tracePrefix); } /// @@ -239,15 +239,15 @@ namespace Umbraco.Web.Routing { const string tracePrefix = "FollowInternalRedirects: "; - if (_documentRequest.PublishedContent == null) + if (_publishedContentRequest.PublishedContent == null) throw new InvalidOperationException("There is no node."); bool redirect = false; - var internalRedirect = _documentRequest.PublishedContent.GetPropertyValue("umbracoInternalRedirectId"); + var internalRedirect = _publishedContentRequest.PublishedContent.GetPropertyValue("umbracoInternalRedirectId"); if (!string.IsNullOrWhiteSpace(internalRedirect)) { - LogHelper.Debug("{0}Found umbracoInternalRedirectId={1}", () => tracePrefix, () => internalRedirect); + LogHelper.Debug("{0}Found umbracoInternalRedirectId={1}", () => tracePrefix, () => internalRedirect); int internalRedirectId; if (!int.TryParse(internalRedirect, out internalRedirectId)) @@ -256,13 +256,13 @@ namespace Umbraco.Web.Routing if (internalRedirectId <= 0) { // bad redirect - log and display the current page (legacy behavior) - //_documentRequest.Document = null; // no! that would be to force a 404 - LogHelper.Debug("{0}Failed to redirect to id={1}: invalid value", () => tracePrefix, () => internalRedirect); + //_publishedContentRequest.Document = null; // no! that would be to force a 404 + LogHelper.Debug("{0}Failed to redirect to id={1}: invalid value", () => tracePrefix, () => internalRedirect); } - else if (internalRedirectId == _documentRequest.DocumentId) + else if (internalRedirectId == _publishedContentRequest.DocumentId) { // redirect to self - LogHelper.Debug("{0}Redirecting to self, ignore", () => tracePrefix); + LogHelper.Debug("{0}Redirecting to self, ignore", () => tracePrefix); } else { @@ -271,15 +271,15 @@ namespace Umbraco.Web.Routing _umbracoContext, internalRedirectId); - _documentRequest.PublishedContent = node; + _publishedContentRequest.PublishedContent = node; if (node != null) { redirect = true; - LogHelper.Debug("{0}Redirecting to id={1}", () => tracePrefix, () => internalRedirectId); + LogHelper.Debug("{0}Redirecting to id={1}", () => tracePrefix, () => internalRedirectId); } else { - LogHelper.Debug("{0}Failed to redirect to id={1}: no such published document", () => tracePrefix, () => internalRedirectId); + LogHelper.Debug("{0}Failed to redirect to id={1}: no such published document", () => tracePrefix, () => internalRedirectId); } } } @@ -295,43 +295,43 @@ namespace Umbraco.Web.Routing { const string tracePrefix = "EnsurePageAccess: "; - if (_documentRequest.PublishedContent == null) + if (_publishedContentRequest.PublishedContent == null) throw new InvalidOperationException("There is no node."); - var path = _documentRequest.PublishedContent.Path; + var path = _publishedContentRequest.PublishedContent.Path; - if (Access.IsProtected(_documentRequest.DocumentId, path)) + if (Access.IsProtected(_publishedContentRequest.DocumentId, path)) { - LogHelper.Debug("{0}Page is protected, check for access", () => tracePrefix); + LogHelper.Debug("{0}Page is protected, check for access", () => tracePrefix); var user = System.Web.Security.Membership.GetUser(); if (user == null || !Member.IsLoggedOn()) { - LogHelper.Debug("{0}Not logged in, redirect to login page", () => tracePrefix); + LogHelper.Debug("{0}Not logged in, redirect to login page", () => tracePrefix); var loginPageId = Access.GetLoginPage(path); - if (loginPageId != _documentRequest.DocumentId) - _documentRequest.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById( + if (loginPageId != _publishedContentRequest.DocumentId) + _publishedContentRequest.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById( _umbracoContext, loginPageId); } - else if (!Access.HasAccces(_documentRequest.DocumentId, user.ProviderUserKey)) + else if (!Access.HasAccces(_publishedContentRequest.DocumentId, user.ProviderUserKey)) { - LogHelper.Debug("{0}Current member has not access, redirect to error page", () => tracePrefix); + LogHelper.Debug("{0}Current member has not access, redirect to error page", () => tracePrefix); var errorPageId = Access.GetErrorPage(path); - if (errorPageId != _documentRequest.DocumentId) - _documentRequest.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById( + if (errorPageId != _publishedContentRequest.DocumentId) + _publishedContentRequest.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById( _umbracoContext, errorPageId); } else { - LogHelper.Debug("{0}Current member has access", () => tracePrefix); + LogHelper.Debug("{0}Current member has access", () => tracePrefix); } } else { - LogHelper.Debug("{0}Page is not protected", () => tracePrefix); + LogHelper.Debug("{0}Page is not protected", () => tracePrefix); } } @@ -341,11 +341,11 @@ namespace Umbraco.Web.Routing private void LookupTemplate() { //return if the request already has a template assigned, this can be possible if an ILookup assigns one - if (_documentRequest.HasTemplate) return; + if (_publishedContentRequest.HasTemplate) return; const string tracePrefix = "LookupTemplate: "; - if (_documentRequest.PublishedContent == null) + if (_publishedContentRequest.PublishedContent == null) throw new InvalidOperationException("There is no node."); //gets item from query string, form, cookie or server vars @@ -357,36 +357,36 @@ namespace Umbraco.Web.Routing // associated with it. //TODO: When we remove the need for a database for templates, then this id should be irrelavent, not sure how were going to do this nicely. - var templateId = _documentRequest.PublishedContent.TemplateId; - LogHelper.Debug("{0}Look for template id={1}", () => tracePrefix, () => templateId); + var templateId = _publishedContentRequest.PublishedContent.TemplateId; + LogHelper.Debug("{0}Look for template id={1}", () => tracePrefix, () => templateId); if (templateId > 0) { //NOTE: This will throw an exception if the template id doesn't exist, but that is ok to inform the front end. var template = new Template(templateId); - _documentRequest.Template = template; + _publishedContentRequest.Template = template; } } else { - LogHelper.Debug("{0}Look for template alias=\"{1}\" (altTemplate)", () => tracePrefix, () => templateAlias); + LogHelper.Debug("{0}Look for template alias=\"{1}\" (altTemplate)", () => tracePrefix, () => templateAlias); var template = Template.GetByAlias(templateAlias); - _documentRequest.Template = template; + _publishedContentRequest.Template = template; } - if (!_documentRequest.HasTemplate) + if (!_publishedContentRequest.HasTemplate) { - LogHelper.Debug("{0}No template was found."); + LogHelper.Debug("{0}No template was found."); // initial idea was: if we're not already 404 and UmbracoSettings.HandleMissingTemplateAs404 is true - // then reset _documentRequest.Document to null to force a 404. + // then reset _publishedContentRequest.Document to null to force a 404. // // but: because we want to let MVC hijack routes even though no template is defined, we decide that // a missing template is OK but the request will then be forwarded to MVC, which will need to take // care of everything. // - // so, don't set _documentRequest.Document to null here + // so, don't set _publishedContentRequest.Document to null here } } @@ -396,15 +396,15 @@ namespace Umbraco.Web.Routing /// As per legacy, if the redirect does not work, we just ignore it. private void FollowRedirect() { - if (_documentRequest.HasNode) + if (_publishedContentRequest.HasNode) { - var redirectId = _documentRequest.PublishedContent.GetPropertyValue("umbracoRedirect", -1); + var redirectId = _publishedContentRequest.PublishedContent.GetPropertyValue("umbracoRedirect", -1); string redirectUrl = "#"; if (redirectId > 0) redirectUrl = _routingContext.NiceUrlProvider.GetNiceUrl(redirectId); if (redirectUrl != "#") - _documentRequest.RedirectUrl = redirectUrl; + _publishedContentRequest.RedirectUrl = redirectUrl; } } } diff --git a/src/Umbraco.Web/Routing/IDocumentLastChanceLookup.cs b/src/Umbraco.Web/Routing/IDocumentLastChanceLookup.cs index f9c38ad9d4..f60cac5631 100644 --- a/src/Umbraco.Web/Routing/IDocumentLastChanceLookup.cs +++ b/src/Umbraco.Web/Routing/IDocumentLastChanceLookup.cs @@ -1,16 +1,16 @@ namespace Umbraco.Web.Routing { /// - /// Provides a method to try to find an assign an Umbraco document to a DocumentRequest when everything else has failed. + /// Provides a method to try to find an assign an Umbraco document to a PublishedContentRequest when everything else has failed. /// internal interface IDocumentLastChanceLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. /// Optionally, can also assign the template, although that is not required. - bool TrySetDocument(DocumentRequest docRequest); + bool TrySetDocument(PublishedContentRequest docRequest); } } \ No newline at end of file diff --git a/src/Umbraco.Web/Routing/IDocumentLookup.cs b/src/Umbraco.Web/Routing/IDocumentLookup.cs index 4ef2b7f872..6b2c107fe4 100644 --- a/src/Umbraco.Web/Routing/IDocumentLookup.cs +++ b/src/Umbraco.Web/Routing/IDocumentLookup.cs @@ -3,16 +3,16 @@ namespace Umbraco.Web.Routing /// - /// Provides a method to try to find an assign an Umbraco document to a DocumentRequest. + /// Provides a method to try to find an assign an Umbraco document to a PublishedContentRequest. /// internal interface IDocumentLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. /// Optionally, can also assign the template or anything else on the document request, although that is not required. - bool TrySetDocument(DocumentRequest docRequest); + bool TrySetDocument(PublishedContentRequest docRequest); } } \ No newline at end of file diff --git a/src/Umbraco.Web/Routing/LookupByAlias.cs b/src/Umbraco.Web/Routing/LookupByAlias.cs index 83ad35d84e..ce52815750 100644 --- a/src/Umbraco.Web/Routing/LookupByAlias.cs +++ b/src/Umbraco.Web/Routing/LookupByAlias.cs @@ -17,11 +17,11 @@ namespace Umbraco.Web.Routing internal class LookupByAlias : IDocumentLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. - public bool TrySetDocument(DocumentRequest docRequest) + public bool TrySetDocument(PublishedContentRequest docRequest) { IPublishedContent node = null; diff --git a/src/Umbraco.Web/Routing/LookupByIdPath.cs b/src/Umbraco.Web/Routing/LookupByIdPath.cs index 59475516fc..0cb60d7e12 100644 --- a/src/Umbraco.Web/Routing/LookupByIdPath.cs +++ b/src/Umbraco.Web/Routing/LookupByIdPath.cs @@ -17,11 +17,11 @@ namespace Umbraco.Web.Routing internal class LookupByIdPath : IDocumentLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. - public bool TrySetDocument(DocumentRequest docRequest) + public bool TrySetDocument(PublishedContentRequest docRequest) { IPublishedContent node = null; diff --git a/src/Umbraco.Web/Routing/LookupByNiceUrl.cs b/src/Umbraco.Web/Routing/LookupByNiceUrl.cs index 13bbd25bb8..b7c2d081c5 100644 --- a/src/Umbraco.Web/Routing/LookupByNiceUrl.cs +++ b/src/Umbraco.Web/Routing/LookupByNiceUrl.cs @@ -16,11 +16,11 @@ namespace Umbraco.Web.Routing internal class LookupByNiceUrl : IDocumentLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. - public virtual bool TrySetDocument(DocumentRequest docRequest) + public virtual bool TrySetDocument(PublishedContentRequest docRequest) { string route; if (docRequest.HasDomain) @@ -33,12 +33,12 @@ namespace Umbraco.Web.Routing } /// - /// Tries to find an Umbraco document for a DocumentRequest and a route. + /// Tries to find an Umbraco document for a PublishedContentRequest and a route. /// /// The document request. /// The route. /// The document node, or null. - protected IPublishedContent LookupDocumentNode(DocumentRequest docreq, string route) + protected IPublishedContent LookupDocumentNode(PublishedContentRequest docreq, string route) { LogHelper.Debug("Test route \"{0}\"", () => route); diff --git a/src/Umbraco.Web/Routing/LookupByNiceUrlAndTemplate.cs b/src/Umbraco.Web/Routing/LookupByNiceUrlAndTemplate.cs index 3d83f72289..96b93534d7 100644 --- a/src/Umbraco.Web/Routing/LookupByNiceUrlAndTemplate.cs +++ b/src/Umbraco.Web/Routing/LookupByNiceUrlAndTemplate.cs @@ -17,12 +17,12 @@ namespace Umbraco.Web.Routing internal class LookupByNiceUrlAndTemplate : LookupByNiceUrl, IDocumentLookup { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. /// If successful, also assigns the template. - public override bool TrySetDocument(DocumentRequest docRequest) + public override bool TrySetDocument(PublishedContentRequest docRequest) { IPublishedContent node = null; string path = docRequest.Uri.AbsolutePath; diff --git a/src/Umbraco.Web/Routing/LookupByPageIdQuery.cs b/src/Umbraco.Web/Routing/LookupByPageIdQuery.cs index 813644bda5..d2a5837daf 100644 --- a/src/Umbraco.Web/Routing/LookupByPageIdQuery.cs +++ b/src/Umbraco.Web/Routing/LookupByPageIdQuery.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Routing /// internal class LookupByPageIdQuery : IDocumentLookup { - public bool TrySetDocument(DocumentRequest docRequest) + public bool TrySetDocument(PublishedContentRequest docRequest) { int pageId; if (int.TryParse(docRequest.RoutingContext.UmbracoContext.HttpContext.Request["umbPageID"], out pageId)) diff --git a/src/Umbraco.Web/Routing/LookupByProfile.cs b/src/Umbraco.Web/Routing/LookupByProfile.cs index 6056426b1d..5ee2168273 100644 --- a/src/Umbraco.Web/Routing/LookupByProfile.cs +++ b/src/Umbraco.Web/Routing/LookupByProfile.cs @@ -18,11 +18,11 @@ namespace Umbraco.Web.Routing internal class LookupByProfile : LookupByNiceUrl { /// - /// Tries to find and assign an Umbraco document to a DocumentRequest. + /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// - /// The DocumentRequest. + /// The PublishedContentRequest. /// A value indicating whether an Umbraco document was found and assigned. - public override bool TrySetDocument(DocumentRequest docRequest) + public override bool TrySetDocument(PublishedContentRequest docRequest) { IPublishedContent node = null; diff --git a/src/Umbraco.Web/Routing/DocumentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs similarity index 92% rename from src/Umbraco.Web/Routing/DocumentRequest.cs rename to src/Umbraco.Web/Routing/PublishedContentRequest.cs index 35f747b8bf..59dadd7d59 100644 --- a/src/Umbraco.Web/Routing/DocumentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -23,9 +23,9 @@ namespace Umbraco.Web.Routing /// represents a request for one specified Umbraco document to be rendered /// by one specified template, using one particular culture. /// - internal class DocumentRequest + internal class PublishedContentRequest { - public DocumentRequest(Uri uri, RoutingContext routingContext) + public PublishedContentRequest(Uri uri, RoutingContext routingContext) { this.Uri = uri; RoutingContext = routingContext; @@ -133,7 +133,7 @@ namespace Umbraco.Web.Routing get { if (this.PublishedContent == null) - throw new InvalidOperationException("DocumentRequest has no document."); + throw new InvalidOperationException("PublishedContentRequest has no document."); return _nodeId; } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index c88a432d1c..87f30a311b 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -367,7 +367,7 @@ - + diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs index 556ed045f1..a0ff73230b 100644 --- a/src/Umbraco.Web/UmbracoContext.cs +++ b/src/Umbraco.Web/UmbracoContext.cs @@ -196,7 +196,7 @@ namespace Umbraco.Web /// public bool IsFrontEndUmbracoRequest { - get { return DocumentRequest != null; } + get { return PublishedContentRequest != null; } } /// @@ -221,9 +221,9 @@ namespace Umbraco.Web internal RoutingContext RoutingContext { get; set; } /// - /// Gets/sets the DocumentRequest object + /// Gets/sets the PublishedContentRequest object /// - internal DocumentRequest DocumentRequest { get; set; } + internal PublishedContentRequest PublishedContentRequest { get; set; } /// /// Exposes the HttpContext for the current request diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 265f7959d1..8fb2e36a3f 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web _umbracoContext = umbracoContext; if (_umbracoContext.IsFrontEndUmbracoRequest) { - _currentPage = _umbracoContext.DocumentRequest.PublishedContent; + _currentPage = _umbracoContext.PublishedContentRequest.PublishedContent; } } @@ -85,9 +85,9 @@ namespace Umbraco.Web { throw new InvalidOperationException("Cannot render a macro when UmbracoContext.PageId is null."); } - if (_umbracoContext.DocumentRequest == null) + if (_umbracoContext.PublishedContentRequest == null) { - throw new InvalidOperationException("Cannot render a macro when there is no current DocumentRequest."); + throw new InvalidOperationException("Cannot render a macro when there is no current PublishedContentRequest."); } var macroProps = new Hashtable(); foreach (var i in parameters) @@ -97,7 +97,7 @@ namespace Umbraco.Web macroProps.Add(i.Key.ToLower(), i.Value); } var macroControl = m.renderMacro(macroProps, - UmbracoContext.Current.DocumentRequest.UmbracoPage.Elements, + UmbracoContext.Current.PublishedContentRequest.UmbracoPage.Elements, _umbracoContext.PageId.Value); containerPage.Controls.Add(macroControl); using (var output = new StringWriter()) diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 2ff3a221e2..99f99fc92c 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -98,11 +98,11 @@ namespace Umbraco.Web LegacyCleanUmbPageFromQueryString(ref uri); // create the new document request since we're rendering a document on the front-end - var docreq = new DocumentRequest( + var docreq = new PublishedContentRequest( umbracoContext.UmbracoUrl, //very important to use this url! it is the path only lowercased version of the current URL. routingContext); //assign the document request to the umbraco context now that we know its a front end request - umbracoContext.DocumentRequest = docreq; + umbracoContext.PublishedContentRequest = docreq; // note - at that point the original legacy module did something do handle IIS custom 404 errors // ie pages looking like /anything.aspx?404;/path/to/document - I guess the reason was to support diff --git a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs index 693af6a0c3..46634b0785 100644 --- a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs @@ -27,7 +27,7 @@ namespace umbraco public class UmbracoDefault : Page { private page _upage; - private DocumentRequest _docRequest; + private PublishedContentRequest _docRequest; bool _validateRequest = true; /// @@ -45,7 +45,7 @@ namespace umbraco base.OnPreInit(e); // get the document request and the page - _docRequest = UmbracoContext.Current.DocumentRequest; + _docRequest = UmbracoContext.Current.PublishedContentRequest; _upage = _docRequest.UmbracoPage; //we need to check this for backwards compatibility in case people still arent' using master pages diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index 994bbce882..ca964091ea 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -104,8 +104,8 @@ namespace umbraco /// /// Initializes a new instance of the class for a published document. /// - /// The pointing to the document. - internal page(DocumentRequest docreq) + /// The pointing to the document. + internal page(PublishedContentRequest docreq) { if (!docreq.HasNode) @@ -280,7 +280,7 @@ namespace umbraco string alias = data.Name; string value = data.FirstChild.Value; - // moved to DocumentRequest + UmbracoModule + // moved to PublishedContentRequest + UmbracoModule //if (alias == "umbracoRedirect") //{ // int i; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs index 6f959809ca..b899838092 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs @@ -207,7 +207,7 @@ namespace umbraco uri = uri.MakeAbsolute(Umbraco.Web.UmbracoContext.Current.UmbracoUrl); uri = Umbraco.Web.UriUtility.UriToUmbraco(uri); - var docreq = new Umbraco.Web.Routing.DocumentRequest(uri, Umbraco.Web.UmbracoContext.Current.RoutingContext); + var docreq = new Umbraco.Web.Routing.PublishedContentRequest(uri, Umbraco.Web.UmbracoContext.Current.RoutingContext); var builder = new Umbraco.Web.Routing.DocumentRequestBuilder(docreq); builder.LookupDomain(); builder.LookupDocument();