diff --git a/src/Umbraco.Web/IUmbracoContext.cs b/src/Umbraco.Abstractions/IUmbracoContext.cs
similarity index 98%
rename from src/Umbraco.Web/IUmbracoContext.cs
rename to src/Umbraco.Abstractions/IUmbracoContext.cs
index c0cee5e9ff..3bc51f224f 100644
--- a/src/Umbraco.Web/IUmbracoContext.cs
+++ b/src/Umbraco.Abstractions/IUmbracoContext.cs
@@ -70,7 +70,7 @@ namespace Umbraco.Web
///
/// Gets/sets the PublishedRequest object
///
- PublishedRequest PublishedRequest { get; set; }
+ IPublishedRequest PublishedRequest { get; set; }
///
/// Gets the variation context accessor.
diff --git a/src/Umbraco.Web/Routing/DomainAndUri.cs b/src/Umbraco.Abstractions/Routing/DomainAndUri.cs
similarity index 100%
rename from src/Umbraco.Web/Routing/DomainAndUri.cs
rename to src/Umbraco.Abstractions/Routing/DomainAndUri.cs
diff --git a/src/Umbraco.Web/Routing/DomainUtilities.cs b/src/Umbraco.Abstractions/Routing/DomainUtilities.cs
similarity index 99%
rename from src/Umbraco.Web/Routing/DomainUtilities.cs
rename to src/Umbraco.Abstractions/Routing/DomainUtilities.cs
index 9255ee46ef..26801cfd27 100644
--- a/src/Umbraco.Web/Routing/DomainUtilities.cs
+++ b/src/Umbraco.Abstractions/Routing/DomainUtilities.cs
@@ -295,7 +295,7 @@ namespace Umbraco.Web.Routing
? currentUri.GetLeftPart(UriPartial.Authority) + domainName
: domainName;
var scheme = currentUri?.Scheme ?? Uri.UriSchemeHttp;
- return new Uri(UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(name, scheme)));
+ return new Uri(UriUtilityCore.TrimPathEndSlash(UriUtilityCore.StartWithScheme(name, scheme)));
}
#endregion
diff --git a/src/Umbraco.Abstractions/Routing/IPublishedRequest.cs b/src/Umbraco.Abstractions/Routing/IPublishedRequest.cs
new file mode 100644
index 0000000000..d0140b9266
--- /dev/null
+++ b/src/Umbraco.Abstractions/Routing/IPublishedRequest.cs
@@ -0,0 +1,234 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using Umbraco.Core.Models;
+using Umbraco.Core.Models.PublishedContent;
+
+namespace Umbraco.Web.Routing
+{
+ public interface IPublishedRequest
+ {
+ ///
+ /// Gets the UmbracoContext.
+ ///
+ IUmbracoContext UmbracoContext { get; }
+
+ ///
+ /// Gets or sets the cleaned up Uri used for routing.
+ ///
+ /// The cleaned up Uri has no virtual directory, no trailing slash, no .aspx extension, etc.
+ Uri Uri { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the Umbraco Backoffice should ignore a collision for this request.
+ ///
+ bool IgnorePublishedContentCollisions { get; set; }
+
+ ///
+ /// Gets or sets the requested content.
+ ///
+ /// Setting the requested content clears Template.
+ IPublishedContent PublishedContent { get; set; }
+
+ ///
+ /// Gets the initial requested content.
+ ///
+ /// The initial requested content is the content that was found by the finders,
+ /// before anything such as 404, redirect... took place.
+ IPublishedContent InitialPublishedContent { get; }
+
+ ///
+ /// Gets value indicating whether the current published content is the initial one.
+ ///
+ bool IsInitialPublishedContent { get; }
+
+ ///
+ /// Gets or sets a value indicating whether the current published content has been obtained
+ /// from the initial published content following internal redirections exclusively.
+ ///
+ /// Used by PublishedContentRequestEngine.FindTemplate() to figure out whether to
+ /// apply the internal redirect or not, when content is not the initial content.
+ bool IsInternalRedirectPublishedContent { get; }
+
+ ///
+ /// Gets a value indicating whether the content request has a content.
+ ///
+ bool HasPublishedContent { get; }
+
+ ITemplate TemplateModel { get; set; }
+
+ ///
+ /// Gets the alias of the template to use to display the requested content.
+ ///
+ string TemplateAlias { get; }
+
+ ///
+ /// Gets a value indicating whether the content request has a template.
+ ///
+ bool HasTemplate { get; }
+
+ void UpdateToNotFound();
+
+ ///
+ /// Gets or sets the content request's domain.
+ ///
+ /// Is a DomainAndUri object ie a standard Domain plus the fully qualified uri. For example,
+ /// the Domain may contain "example.com" whereas the Uri will be fully qualified eg "http://example.com/".
+ DomainAndUri Domain { get; set; }
+
+ ///
+ /// Gets a value indicating whether the content request has a domain.
+ ///
+ bool HasDomain { get; }
+
+ ///
+ /// Gets or sets the content request's culture.
+ ///
+ CultureInfo Culture { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the requested content could not be found.
+ ///
+ /// This is set in the PublishedContentRequestBuilder and can also be used in
+ /// custom content finders or Prepared event handlers, where we want to allow developers
+ /// to indicate a request is 404 but not to cancel it.
+ bool Is404 { get; set; }
+
+ ///
+ /// Gets a value indicating whether the content request triggers a redirect (permanent or not).
+ ///
+ bool IsRedirect { get; }
+
+ ///
+ /// Gets or sets a value indicating whether the redirect is permanent.
+ ///
+ bool IsRedirectPermanent { get; }
+
+ ///
+ /// Gets or sets the url to redirect to, when the content request triggers a redirect.
+ ///
+ string RedirectUrl { get; }
+
+ ///
+ /// Gets or sets the content request http response status code.
+ ///
+ /// Does not actually set the http response status code, only registers that the response
+ /// should use the specified code. The code will or will not be used, in due time.
+ int ResponseStatusCode { get; }
+
+ ///
+ /// Gets or sets the content request http response status description.
+ ///
+ /// Does not actually set the http response status description, only registers that the response
+ /// should use the specified description. The description will or will not be used, in due time.
+ string ResponseStatusDescription { get; }
+
+ ///
+ /// Gets or sets the System.Web.HttpCacheability
+ ///
+// Note: we used to set a default value here but that would then be the default
+// for ALL requests, we shouldn't overwrite it though if people are using [OutputCache] for example
+// see: https://our.umbraco.com/forum/using-umbraco-and-getting-started/79715-output-cache-in-umbraco-752
+ //HttpCacheability Cacheability { get; set; }
+
+ ///
+ /// Gets or sets a list of Extensions to append to the Response.Cache object.
+ ///
+ List CacheExtensions { get; set; }
+
+ ///
+ /// Gets or sets a dictionary of Headers to append to the Response object.
+ ///
+ Dictionary Headers { get; set; }
+
+ bool CacheabilityNoCache { get; set; }
+
+ // PublishedContentHashtableConverter LegacyContentHashTable { get; set; }
+
+ ///
+ /// Prepares the request.
+ ///
+ void Prepare();
+
+ ///
+ /// Triggers the Preparing event.
+ ///
+ void OnPreparing();
+
+ ///
+ /// Triggers the Prepared event.
+ ///
+ void OnPrepared();
+
+ ///
+ /// Sets the requested content, following an internal redirect.
+ ///
+ /// The requested content.
+ /// Depending on UmbracoSettings.InternalRedirectPreservesTemplate, will
+ /// preserve or reset the template, if any.
+ void SetInternalRedirectPublishedContent(IPublishedContent content);
+
+ ///
+ /// Indicates that the current PublishedContent is the initial one.
+ ///
+ void SetIsInitialPublishedContent();
+
+ ///
+ /// Tries to set the template to use to display the requested content.
+ ///
+ /// The alias of the template.
+ /// A value indicating whether a valid template with the specified alias was found.
+ ///
+ /// Successfully setting the template does refresh RenderingEngine.
+ /// If setting the template fails, then the previous template (if any) remains in place.
+ ///
+ bool TrySetTemplate(string alias);
+
+ ///
+ /// Sets the template to use to display the requested content.
+ ///
+ /// The template.
+ /// Setting the template does refresh RenderingEngine.
+ void SetTemplate(ITemplate template);
+
+ ///
+ /// Resets the template.
+ ///
+ void ResetTemplate();
+
+ ///
+ /// Indicates that the content request should trigger a redirect (302).
+ ///
+ /// The url to redirect to.
+ /// Does not actually perform a redirect, only registers that the response should
+ /// redirect. Redirect will or will not take place in due time.
+ void SetRedirect(string url);
+
+ ///
+ /// Indicates that the content request should trigger a permanent redirect (301).
+ ///
+ /// The url to redirect to.
+ /// Does not actually perform a redirect, only registers that the response should
+ /// redirect. Redirect will or will not take place in due time.
+ void SetRedirectPermanent(string url);
+
+ ///
+ /// Indicates that the content request should trigger a redirect, with a specified status code.
+ ///
+ /// The url to redirect to.
+ /// The status code (300-308).
+ /// Does not actually perform a redirect, only registers that the response should
+ /// redirect. Redirect will or will not take place in due time.
+ void SetRedirect(string url, int status);
+
+ ///
+ /// Sets the http response status code, along with an optional associated description.
+ ///
+ /// The http status code.
+ /// The description.
+ /// Does not actually set the http response status code and description, only registers that
+ /// the response should use the specified code and description. The code and description will or will
+ /// not be used, in due time.
+ void SetResponseStatus(int code, string description = null);
+ }
+}
diff --git a/src/Umbraco.Web/Routing/ISiteDomainHelper.cs b/src/Umbraco.Abstractions/Routing/ISiteDomainHelper.cs
similarity index 100%
rename from src/Umbraco.Web/Routing/ISiteDomainHelper.cs
rename to src/Umbraco.Abstractions/Routing/ISiteDomainHelper.cs
diff --git a/src/Umbraco.Abstractions/UriUtilityCore.cs b/src/Umbraco.Abstractions/UriUtilityCore.cs
new file mode 100644
index 0000000000..9ca9d66229
--- /dev/null
+++ b/src/Umbraco.Abstractions/UriUtilityCore.cs
@@ -0,0 +1,59 @@
+using System;
+using Umbraco.Core;
+
+namespace Umbraco.Web
+{
+ public static class UriUtilityCore
+ {
+
+ #region Uri string utilities
+
+ public static bool HasScheme(string uri)
+ {
+ return uri.IndexOf("://") > 0;
+ }
+
+ public static string StartWithScheme(string uri)
+ {
+ return StartWithScheme(uri, null);
+ }
+
+ public static string StartWithScheme(string uri, string scheme)
+ {
+ return HasScheme(uri) ? uri : String.Format("{0}://{1}", scheme ?? Uri.UriSchemeHttp, uri);
+ }
+
+ public static string EndPathWithSlash(string uri)
+ {
+ var pos1 = Math.Max(0, uri.IndexOf('?'));
+ var pos2 = Math.Max(0, uri.IndexOf('#'));
+ var pos = Math.Min(pos1, pos2);
+
+ var path = pos > 0 ? uri.Substring(0, pos) : uri;
+ path = path.EnsureEndsWith('/');
+
+ if (pos > 0)
+ path += uri.Substring(pos);
+
+ return path;
+ }
+
+ public static string TrimPathEndSlash(string uri)
+ {
+ var pos1 = Math.Max(0, uri.IndexOf('?'));
+ var pos2 = Math.Max(0, uri.IndexOf('#'));
+ var pos = Math.Min(pos1, pos2);
+
+ var path = pos > 0 ? uri.Substring(0, pos) : uri;
+ path = path.TrimEnd('/');
+
+ if (pos > 0)
+ path += uri.Substring(pos);
+
+ return path;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/src/Umbraco.Tests/Composing/TypeFinderTests.cs b/src/Umbraco.Tests/Composing/TypeFinderTests.cs
index a2ed0690e5..5fe4c241d6 100644
--- a/src/Umbraco.Tests/Composing/TypeFinderTests.cs
+++ b/src/Umbraco.Tests/Composing/TypeFinderTests.cs
@@ -69,7 +69,7 @@ namespace Umbraco.Tests.Composing
var typesFound = typeFinder.FindClassesWithAttribute(_assemblies);
Assert.AreEqual(0, typesFound.Count()); // 0 classes in _assemblies are marked with [Tree]
- typesFound = typeFinder.FindClassesWithAttribute(new[] { typeof (IUmbracoContext).Assembly });
+ typesFound = typeFinder.FindClassesWithAttribute(new[] { typeof (UmbracoContext).Assembly });
Assert.AreEqual(22, typesFound.Count()); // + classes in Umbraco.Web are marked with [Tree]
}
diff --git a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
index 641d4814ec..a49fdf3abe 100644
--- a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
+++ b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
@@ -46,7 +46,7 @@ namespace Umbraco.Tests.Composing
//typeof(TabPage).Assembly,
typeof(System.Web.Mvc.ActionResult).Assembly,
typeof(TypeFinder).Assembly,
- typeof(IUmbracoContext).Assembly,
+ typeof(UmbracoContext).Assembly,
typeof(CheckBoxListPropertyEditor).Assembly
});
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedRouterTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedRouterTests.cs
index f8f7ddae75..70cc26eaf8 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedRouterTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedRouterTests.cs
@@ -39,21 +39,6 @@ namespace Umbraco.Tests.PublishedContent
Assert.IsFalse(result);
}
-
- [Test]
- public void ConfigureRequest_Sets_UmbracoPage_When_Published_Content_Assigned()
- {
- var umbracoContext = GetUmbracoContext("/test");
- var publishedRouter = CreatePublishedRouter();
- var request = publishedRouter.CreateRequest(umbracoContext);
- var content = GetPublishedContentMock();
- request.Culture = new CultureInfo("en-AU");
- request.PublishedContent = content.Object;
- publishedRouter.ConfigureRequest(request);
-
- Assert.IsNotNull(request.LegacyContentHashTable);
- }
-
private Mock GetPublishedContentMock()
{
var pc = new Mock();
diff --git a/src/Umbraco.Tests/TestHelpers/Stubs/TestLastChanceFinder.cs b/src/Umbraco.Tests/TestHelpers/Stubs/TestLastChanceFinder.cs
index 6a43f6180d..48517f85dd 100644
--- a/src/Umbraco.Tests/TestHelpers/Stubs/TestLastChanceFinder.cs
+++ b/src/Umbraco.Tests/TestHelpers/Stubs/TestLastChanceFinder.cs
@@ -4,7 +4,7 @@ namespace Umbraco.Tests.TestHelpers.Stubs
{
internal class TestLastChanceFinder : IContentLastChanceFinder
{
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
return false;
}
diff --git a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
index 5e921eb7c2..ac0092ceb6 100644
--- a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
+++ b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
@@ -17,21 +17,21 @@ namespace Umbraco.Web.Macros
///
/// Legacy class used by macros which converts a published content item into a hashset of values
///
- internal class PublishedContentHashtableConverter
+ public class PublishedContentHashtableConverter
{
#region Constructors
///
/// Initializes a new instance of the class for a published document request.
///
- /// The pointing to the document.
+ /// The pointing to the document.
/// The .
///
/// The difference between creating the page with PublishedRequest vs an IPublishedContent item is
/// that the PublishedRequest takes into account how a template is assigned during the routing process whereas
/// with an IPublishedContent item, the template id is assigned purely based on the default.
///
- internal PublishedContentHashtableConverter(PublishedRequest frequest, IUserService userService)
+ internal PublishedContentHashtableConverter(IPublishedRequest frequest, IUserService userService)
{
if (!frequest.HasPublishedContent)
throw new ArgumentException("Document request has no node.", nameof(frequest));
diff --git a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
index 31a3d6a9ea..2de0accd74 100644
--- a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
+++ b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
@@ -99,7 +99,7 @@ namespace Umbraco.Web.Mvc
///
///
///
- protected virtual void ConfigurePublishedContentRequest(PublishedRequest request, ActionExecutedContext filterContext)
+ protected virtual void ConfigurePublishedContentRequest(IPublishedRequest request, ActionExecutedContext filterContext)
{
if (_contentId.HasValue)
{
diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs
index 4d191d8f30..005a2da495 100644
--- a/src/Umbraco.Web/Mvc/RenderMvcController.cs
+++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs
@@ -18,7 +18,7 @@ namespace Umbraco.Web.Mvc
[ModelBindingExceptionFilter]
public class RenderMvcController : UmbracoController, IRenderMvcController
{
- private PublishedRequest _publishedRequest;
+ private IPublishedRequest _publishedRequest;
public RenderMvcController()
{
@@ -44,7 +44,7 @@ namespace Umbraco.Web.Mvc
///
/// Gets the current published content request.
///
- protected internal virtual PublishedRequest PublishedRequest
+ protected internal virtual IPublishedRequest PublishedRequest
{
get
{
@@ -54,7 +54,7 @@ namespace Umbraco.Web.Mvc
{
throw new InvalidOperationException("DataTokens must contain an 'umbraco-doc-request' key with a PublishedRequest object");
}
- _publishedRequest = (PublishedRequest)RouteData.DataTokens[Core.Constants.Web.PublishedDocumentRequestDataToken];
+ _publishedRequest = (IPublishedRequest)RouteData.DataTokens[Core.Constants.Web.PublishedDocumentRequestDataToken];
return _publishedRequest;
}
}
diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
index 186c9f212a..3dfca3b6f4 100644
--- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
+++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
@@ -86,7 +86,7 @@ namespace Umbraco.Web.Mvc
///
///
///
- internal void SetupRouteDataForRequest(ContentModel contentModel, RequestContext requestContext, PublishedRequest frequest)
+ internal void SetupRouteDataForRequest(ContentModel contentModel, RequestContext requestContext, IPublishedRequest frequest)
{
//put essential data into the data tokens, the 'umbraco' key is required to be there for the view engine
requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, contentModel); //required for the ContentModelBinder and view engine
@@ -241,7 +241,7 @@ namespace Umbraco.Web.Mvc
///
///
///
- internal virtual RouteDefinition GetUmbracoRouteDefinition(RequestContext requestContext, PublishedRequest request)
+ internal virtual RouteDefinition GetUmbracoRouteDefinition(RequestContext requestContext, IPublishedRequest request)
{
if (requestContext == null) throw new ArgumentNullException(nameof(requestContext));
if (request == null) throw new ArgumentNullException(nameof(request));
@@ -306,7 +306,7 @@ namespace Umbraco.Web.Mvc
return def;
}
- internal IHttpHandler GetHandlerOnMissingTemplate(PublishedRequest request)
+ internal IHttpHandler GetHandlerOnMissingTemplate(IPublishedRequest request)
{
if (request == null) throw new ArgumentNullException(nameof(request));
@@ -331,7 +331,7 @@ namespace Umbraco.Web.Mvc
///
///
///
- internal IHttpHandler GetHandlerForRoute(RequestContext requestContext, PublishedRequest request)
+ internal IHttpHandler GetHandlerForRoute(RequestContext requestContext, IPublishedRequest request)
{
if (requestContext == null) throw new ArgumentNullException(nameof(requestContext));
if (request == null) throw new ArgumentNullException(nameof(request));
diff --git a/src/Umbraco.Web/Mvc/RouteDefinition.cs b/src/Umbraco.Web/Mvc/RouteDefinition.cs
index 89b0467dc3..94f97e7e11 100644
--- a/src/Umbraco.Web/Mvc/RouteDefinition.cs
+++ b/src/Umbraco.Web/Mvc/RouteDefinition.cs
@@ -21,7 +21,7 @@ namespace Umbraco.Web.Mvc
///
/// Everything related to the current content request including the requested content
///
- public PublishedRequest PublishedRequest { get; set; }
+ public IPublishedRequest PublishedRequest { get; set; }
///
/// Gets/sets whether the current request has a hijacked route/user controller routed for it
diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs
index a8f5452ce1..9526452757 100644
--- a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs
@@ -56,7 +56,7 @@ namespace Umbraco.Web.Mvc
///
/// Gets the public content request.
///
- internal PublishedRequest PublishedRequest
+ internal IPublishedRequest PublishedRequest
{
get
{
@@ -67,11 +67,11 @@ namespace Umbraco.Web.Mvc
// try view context
if (ViewContext.RouteData.DataTokens.ContainsKey(token))
- return (PublishedRequest) ViewContext.RouteData.DataTokens.GetRequiredObject(token);
+ return (IPublishedRequest) ViewContext.RouteData.DataTokens.GetRequiredObject(token);
// child action, try parent view context
if (ViewContext.IsChildAction && ViewContext.ParentActionViewContext.RouteData.DataTokens.ContainsKey(token))
- return (PublishedRequest) ViewContext.ParentActionViewContext.RouteData.DataTokens.GetRequiredObject(token);
+ return (IPublishedRequest) ViewContext.ParentActionViewContext.RouteData.DataTokens.GetRequiredObject(token);
// fallback to UmbracoContext
return UmbracoContext.PublishedRequest;
diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
index 9d6b336265..56549073f4 100644
--- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
@@ -90,7 +90,7 @@ namespace Umbraco.Web.Mvc
protected abstract IPublishedContent FindContent(RequestContext requestContext, IUmbracoContext umbracoContext);
- protected virtual void PreparePublishedContentRequest(PublishedRequest request)
+ protected virtual void PreparePublishedContentRequest(IPublishedRequest request)
{
PublishedRouter.PrepareRequest(request);
}
diff --git a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs
index 7dc8203d40..f8e21982e0 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs
@@ -32,7 +32,7 @@ namespace Umbraco.Web.Routing
///
/// The PublishedRequest.
/// A value indicating whether an Umbraco document was found and assigned.
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
_logger.Debug("Looking for a page to handle 404.");
diff --git a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs
index 5e0e3b2ace..52d07300ab 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Routing
///
/// The PublishedRequest.
/// A value indicating whether an Umbraco document was found and assigned.
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
if (frequest.UmbracoContext != null && frequest.UmbracoContext.InPreviewMode == false
diff --git a/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs b/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs
index eb1abbb718..790da3cc89 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs
@@ -16,7 +16,7 @@
_httpContextAccessor = httpContextAccessor;
}
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
int pageId;
if (int.TryParse(_httpContextAccessor.HttpContext.Request["umbPageID"], out pageId))
diff --git a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs
index 46e44dc5a3..9a8c1d2729 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs
@@ -30,7 +30,7 @@ namespace Umbraco.Web.Routing
/// The PublishedRequest.
/// 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.
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
var route = frequest.HasDomain
? frequest.Domain.ContentId + DomainUtilities.PathRelativeToDomain(frequest.Domain.Uri, frequest.Uri.GetAbsolutePathDecoded())
@@ -63,7 +63,8 @@ namespace Umbraco.Web.Routing
// See http://issues.umbraco.org/issue/U4-8361#comment=67-30532
// Setting automatic 301 redirects to not be cached because browsers cache these very aggressively which then leads
// to problems if you rename a page back to it's original name or create a new page with the original name
- frequest.Cacheability = HttpCacheability.NoCache;
+ //frequest.Cacheability = HttpCacheability.NoCache;
+ frequest.CacheabilityNoCache = true;
frequest.CacheExtensions = new List { "no-store, must-revalidate" };
frequest.Headers = new Dictionary { { "Pragma", "no-cache" }, { "Expires", "0" } };
diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs
index 0a14dc97fe..3fcffff842 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs
@@ -24,7 +24,7 @@ namespace Umbraco.Web.Routing
///
/// The PublishedRequest.
/// A value indicating whether an Umbraco document was found and assigned.
- public virtual bool TryFindContent(PublishedRequest frequest)
+ public virtual bool TryFindContent(IPublishedRequest frequest)
{
string route;
if (frequest.HasDomain)
@@ -42,7 +42,7 @@ namespace Umbraco.Web.Routing
/// The document request.
/// The route.
/// The document node, or null.
- protected IPublishedContent FindContent(PublishedRequest docreq, string route)
+ protected IPublishedContent FindContent(IPublishedRequest docreq, string route)
{
if (docreq == null) throw new System.ArgumentNullException(nameof(docreq));
diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs
index cf71611047..ae435eff87 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs
@@ -30,7 +30,7 @@ namespace Umbraco.Web.Routing
///
/// The PublishedRequest.
/// A value indicating whether an Umbraco document was found and assigned.
- public bool TryFindContent(PublishedRequest frequest)
+ public bool TryFindContent(IPublishedRequest frequest)
{
IPublishedContent node = null;
diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs
index 16dfa63596..84529dfaa1 100644
--- a/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs
+++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs
@@ -32,7 +32,7 @@ namespace Umbraco.Web.Routing
/// The PublishedRequest.
/// A value indicating whether an Umbraco document was found and assigned.
/// If successful, also assigns the template.
- public override bool TryFindContent(PublishedRequest frequest)
+ public override bool TryFindContent(IPublishedRequest frequest)
{
IPublishedContent node = null;
var path = frequest.Uri.GetAbsolutePathDecoded();
diff --git a/src/Umbraco.Web/Routing/IContentFinder.cs b/src/Umbraco.Web/Routing/IContentFinder.cs
index 2e388c4814..39d31741a6 100644
--- a/src/Umbraco.Web/Routing/IContentFinder.cs
+++ b/src/Umbraco.Web/Routing/IContentFinder.cs
@@ -11,6 +11,6 @@ namespace Umbraco.Web.Routing
/// The PublishedRequest.
/// 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 TryFindContent(PublishedRequest request);
+ bool TryFindContent(IPublishedRequest request);
}
}
diff --git a/src/Umbraco.Web/Routing/IPublishedRouter.cs b/src/Umbraco.Web/Routing/IPublishedRouter.cs
index 77502612c3..db9d69df20 100644
--- a/src/Umbraco.Web/Routing/IPublishedRouter.cs
+++ b/src/Umbraco.Web/Routing/IPublishedRouter.cs
@@ -17,21 +17,21 @@ namespace Umbraco.Web.Routing
/// The current Umbraco context.
/// The (optional) request Uri.
/// A published request.
- PublishedRequest CreateRequest(IUmbracoContext umbracoContext, Uri uri = null);
+ IPublishedRequest CreateRequest(IUmbracoContext umbracoContext, Uri uri = null);
///
/// Prepares a request for rendering.
///
/// The request.
/// A value indicating whether the request was successfully prepared and can be rendered.
- bool PrepareRequest(PublishedRequest request);
+ bool PrepareRequest(IPublishedRequest request);
///
/// Tries to route a request.
///
/// The request.
/// A value indicating whether the request can be routed to a document.
- bool TryRouteRequest(PublishedRequest request);
+ bool TryRouteRequest(IPublishedRequest request);
///
/// Gets a template.
@@ -49,6 +49,6 @@ namespace Umbraco.Web.Routing
/// the request, for whatever reason, and wants to force it to be re-routed
/// and rendered as if no document were found (404).
///
- void UpdateRequestToNotFound(PublishedRequest request);
+ void UpdateRequestToNotFound(IPublishedRequest request);
}
}
diff --git a/src/Umbraco.Web/Routing/PublishedRequest.cs b/src/Umbraco.Web/Routing/PublishedRequest.cs
index 13074fce07..b1337f3b87 100644
--- a/src/Umbraco.Web/Routing/PublishedRequest.cs
+++ b/src/Umbraco.Web/Routing/PublishedRequest.cs
@@ -12,213 +12,6 @@ using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Web.Routing
{
- public interface IPublishedRequest
- {
- ///
- /// Gets the UmbracoContext.
- ///
- IUmbracoContext UmbracoContext { get; }
-
- ///
- /// Gets or sets the cleaned up Uri used for routing.
- ///
- /// The cleaned up Uri has no virtual directory, no trailing slash, no .aspx extension, etc.
- Uri Uri { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the Umbraco Backoffice should ignore a collision for this request.
- ///
- bool IgnorePublishedContentCollisions { get; set; }
-
- ///
- /// Gets or sets the requested content.
- ///
- /// Setting the requested content clears Template.
- IPublishedContent PublishedContent { get; set; }
-
- ///
- /// Gets the initial requested content.
- ///
- /// The initial requested content is the content that was found by the finders,
- /// before anything such as 404, redirect... took place.
- IPublishedContent InitialPublishedContent { get; }
-
- ///
- /// Gets value indicating whether the current published content is the initial one.
- ///
- bool IsInitialPublishedContent { get; }
-
- ///
- /// Gets or sets a value indicating whether the current published content has been obtained
- /// from the initial published content following internal redirections exclusively.
- ///
- /// Used by PublishedContentRequestEngine.FindTemplate() to figure out whether to
- /// apply the internal redirect or not, when content is not the initial content.
- bool IsInternalRedirectPublishedContent { get; }
-
- ///
- /// Gets a value indicating whether the content request has a content.
- ///
- bool HasPublishedContent { get; }
-
- ///
- /// Gets the alias of the template to use to display the requested content.
- ///
- string TemplateAlias { get; }
-
- ///
- /// Gets a value indicating whether the content request has a template.
- ///
- bool HasTemplate { get; }
-
- ///
- /// Gets or sets the content request's domain.
- ///
- /// Is a DomainAndUri object ie a standard Domain plus the fully qualified uri. For example,
- /// the Domain may contain "example.com" whereas the Uri will be fully qualified eg "http://example.com/".
- DomainAndUri Domain { get; set; }
-
- ///
- /// Gets a value indicating whether the content request has a domain.
- ///
- bool HasDomain { get; }
-
- ///
- /// Gets or sets the content request's culture.
- ///
- CultureInfo Culture { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the requested content could not be found.
- ///
- /// This is set in the PublishedContentRequestBuilder and can also be used in
- /// custom content finders or Prepared event handlers, where we want to allow developers
- /// to indicate a request is 404 but not to cancel it.
- bool Is404 { get; set; }
-
- ///
- /// Gets a value indicating whether the content request triggers a redirect (permanent or not).
- ///
- bool IsRedirect { get; }
-
- ///
- /// Gets or sets a value indicating whether the redirect is permanent.
- ///
- bool IsRedirectPermanent { get; }
-
- ///
- /// Gets or sets the url to redirect to, when the content request triggers a redirect.
- ///
- string RedirectUrl { get; }
-
- ///
- /// Gets or sets the content request http response status code.
- ///
- /// Does not actually set the http response status code, only registers that the response
- /// should use the specified code. The code will or will not be used, in due time.
- int ResponseStatusCode { get; }
-
- ///
- /// Gets or sets the content request http response status description.
- ///
- /// Does not actually set the http response status description, only registers that the response
- /// should use the specified description. The description will or will not be used, in due time.
- string ResponseStatusDescription { get; }
-
- ///
- /// Gets or sets the System.Web.HttpCacheability
- ///
-// Note: we used to set a default value here but that would then be the default
-// for ALL requests, we shouldn't overwrite it though if people are using [OutputCache] for example
-// see: https://our.umbraco.com/forum/using-umbraco-and-getting-started/79715-output-cache-in-umbraco-752
- HttpCacheability Cacheability { get; set; }
-
- ///
- /// Gets or sets a list of Extensions to append to the Response.Cache object.
- ///
- List CacheExtensions { get; set; }
-
- ///
- /// Gets or sets a dictionary of Headers to append to the Response object.
- ///
- Dictionary Headers { get; set; }
-
- ///
- /// Prepares the request.
- ///
- void Prepare();
-
- ///
- /// Sets the requested content, following an internal redirect.
- ///
- /// The requested content.
- /// Depending on UmbracoSettings.InternalRedirectPreservesTemplate, will
- /// preserve or reset the template, if any.
- void SetInternalRedirectPublishedContent(IPublishedContent content);
-
- ///
- /// Indicates that the current PublishedContent is the initial one.
- ///
- void SetIsInitialPublishedContent();
-
- ///
- /// Tries to set the template to use to display the requested content.
- ///
- /// The alias of the template.
- /// A value indicating whether a valid template with the specified alias was found.
- ///
- /// Successfully setting the template does refresh RenderingEngine.
- /// If setting the template fails, then the previous template (if any) remains in place.
- ///
- bool TrySetTemplate(string alias);
-
- ///
- /// Sets the template to use to display the requested content.
- ///
- /// The template.
- /// Setting the template does refresh RenderingEngine.
- void SetTemplate(ITemplate template);
-
- ///
- /// Resets the template.
- ///
- void ResetTemplate();
-
- ///
- /// Indicates that the content request should trigger a redirect (302).
- ///
- /// The url to redirect to.
- /// Does not actually perform a redirect, only registers that the response should
- /// redirect. Redirect will or will not take place in due time.
- void SetRedirect(string url);
-
- ///
- /// Indicates that the content request should trigger a permanent redirect (301).
- ///
- /// The url to redirect to.
- /// Does not actually perform a redirect, only registers that the response should
- /// redirect. Redirect will or will not take place in due time.
- void SetRedirectPermanent(string url);
-
- ///
- /// Indicates that the content request should trigger a redirect, with a specified status code.
- ///
- /// The url to redirect to.
- /// The status code (300-308).
- /// Does not actually perform a redirect, only registers that the response should
- /// redirect. Redirect will or will not take place in due time.
- void SetRedirect(string url, int status);
-
- ///
- /// Sets the http response status code, along with an optional associated description.
- ///
- /// The http status code.
- /// The description.
- /// Does not actually set the http response status code and description, only registers that
- /// the response should use the specified code and description. The code and description will or will
- /// not be used, in due time.
- void SetResponseStatus(int code, string description = null);
- }
///
/// Represents a request for one specified Umbraco IPublishedContent to be rendered
@@ -240,7 +33,7 @@ namespace Umbraco.Web.Routing
private PublishedContentHashtableConverter _umbracoPage; // legacy
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The published router.
/// The Umbraco context.
@@ -274,12 +67,14 @@ namespace Umbraco.Web.Routing
}
// utility for ensuring it is ok to set some properties
- private void EnsureWriteable()
+ public void EnsureWriteable()
{
if (_readonly)
throw new InvalidOperationException("Cannot modify a PublishedRequest once it is read-only.");
}
+ public bool CacheabilityNoCache { get; set; }
+
///
/// Prepares the request.
///
@@ -314,7 +109,7 @@ namespace Umbraco.Web.Routing
///
/// Triggers the Preparing event.
///
- internal void OnPreparing()
+ public void OnPreparing()
{
Preparing?.Invoke(this, EventArgs.Empty);
_readonlyUri = true;
@@ -323,7 +118,7 @@ namespace Umbraco.Web.Routing
///
/// Triggers the Prepared event.
///
- internal void OnPrepared()
+ public void OnPrepared()
{
Prepared?.Invoke(this, EventArgs.Empty);
@@ -439,7 +234,7 @@ namespace Umbraco.Web.Routing
///
/// Gets or sets the template model to use to display the requested content.
///
- internal ITemplate TemplateModel { get; set; }
+ public ITemplate TemplateModel { get; set; }
///
/// Gets the alias of the template to use to display the requested content.
@@ -501,7 +296,7 @@ namespace Umbraco.Web.Routing
///
public bool HasTemplate => TemplateModel != null;
- internal void UpdateToNotFound()
+ public void UpdateToNotFound()
{
var __readonly = _readonly;
_readonly = false;
@@ -672,7 +467,7 @@ namespace Umbraco.Web.Routing
// Note: we used to set a default value here but that would then be the default
// for ALL requests, we shouldn't overwrite it though if people are using [OutputCache] for example
// see: https://our.umbraco.com/forum/using-umbraco-and-getting-started/79715-output-cache-in-umbraco-752
- public HttpCacheability Cacheability { get; set; }
+ //public HttpCacheability Cacheability { get; set; }
///
/// Gets or sets a list of Extensions to append to the Response.Cache object.
@@ -690,7 +485,7 @@ namespace Umbraco.Web.Routing
// for legacy/webforms/macro code -
// TODO: get rid of it eventually
- internal PublishedContentHashtableConverter LegacyContentHashTable
+ public PublishedContentHashtableConverter LegacyContentHashTable
{
get
{
diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs
index 1afbaceccf..a0ebfceaa5 100644
--- a/src/Umbraco.Web/Routing/PublishedRouter.cs
+++ b/src/Umbraco.Web/Routing/PublishedRouter.cs
@@ -58,7 +58,7 @@ namespace Umbraco.Web.Routing
}
///
- public PublishedRequest CreateRequest(IUmbracoContext umbracoContext, Uri uri = null)
+ public IPublishedRequest CreateRequest(IUmbracoContext umbracoContext, Uri uri = null)
{
return new PublishedRequest(this, umbracoContext, _umbracoSettingsSection, uri ?? umbracoContext.CleanedUmbracoUrl);
}
@@ -66,7 +66,7 @@ namespace Umbraco.Web.Routing
#region Request
///
- public bool TryRouteRequest(PublishedRequest request)
+ public bool TryRouteRequest(IPublishedRequest request)
{
// disabled - is it going to change the routing?
//_pcr.OnPreparing();
@@ -97,7 +97,7 @@ namespace Umbraco.Web.Routing
}
///
- public bool PrepareRequest(PublishedRequest request)
+ public bool PrepareRequest(IPublishedRequest request)
{
// 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
@@ -168,7 +168,7 @@ namespace Umbraco.Web.Routing
/// This method logic has been put into it's own method in case developers have created a custom PCR or are assigning their own values
/// but need to finalize it themselves.
///
- public bool ConfigureRequest(PublishedRequest frequest)
+ public bool ConfigureRequest(IPublishedRequest frequest)
{
if (frequest.HasPublishedContent == false)
{
@@ -200,13 +200,13 @@ namespace Umbraco.Web.Routing
// assign the legacy page back to the request
// handlers like default.aspx will want it and most macros currently need it
- frequest.LegacyContentHashTable = new PublishedContentHashtableConverter(frequest, _userService);
+ // frequest.LegacyContentHashTable = new PublishedContentHashtableConverter(frequest, _userService);
return true;
}
///
- public void UpdateRequestToNotFound(PublishedRequest request)
+ public void UpdateRequestToNotFound(IPublishedRequest request)
{
// clear content
var content = request.PublishedContent;
@@ -240,7 +240,7 @@ namespace Umbraco.Web.Routing
// assign the legacy page back to the docrequest
// handlers like default.aspx will want it and most macros currently need it
- request.LegacyContentHashTable = new PublishedContentHashtableConverter(request, _userService);
+ // request.LegacyContentHashTable = new PublishedContentHashtableConverter(request, _userService);
}
#endregion
@@ -251,7 +251,7 @@ namespace Umbraco.Web.Routing
/// Finds the site root (if any) matching the http request, and updates the PublishedRequest accordingly.
///
/// A value indicating whether a domain was found.
- internal bool FindDomain(PublishedRequest request)
+ internal bool FindDomain(IPublishedRequest request)
{
const string tracePrefix = "FindDomain: ";
@@ -322,7 +322,7 @@ namespace Umbraco.Web.Routing
///
/// Looks for wildcard domains in the path and updates Culture accordingly.
///
- internal void HandleWildcardDomains(PublishedRequest request)
+ internal void HandleWildcardDomains(IPublishedRequest request)
{
const string tracePrefix = "HandleWildcardDomains: ";
@@ -382,7 +382,7 @@ namespace Umbraco.Web.Routing
/// Finds the Umbraco document (if any) matching the request, and updates the PublishedRequest accordingly.
///
/// A value indicating whether a document and template were found.
- private void FindPublishedContentAndTemplate(PublishedRequest request)
+ private void FindPublishedContentAndTemplate(IPublishedRequest request)
{
_logger.Debug("FindPublishedContentAndTemplate: Path={UriAbsolutePath}", request.Uri.AbsolutePath);
@@ -412,7 +412,7 @@ namespace Umbraco.Web.Routing
/// Tries to find the document matching the request, by running the IPublishedContentFinder instances.
///
/// There is no finder collection.
- internal void FindPublishedContent(PublishedRequest request)
+ internal void FindPublishedContent(IPublishedRequest request)
{
const string tracePrefix = "FindPublishedContent: ";
@@ -444,7 +444,7 @@ namespace Umbraco.Web.Routing
/// Handles "not found", internal redirects, access validation...
/// things that must be handled in one place because they can create loops
///
- private void HandlePublishedContent(PublishedRequest request)
+ private void HandlePublishedContent(IPublishedRequest request)
{
// because these might loop, we have to have some sort of infinite loop detection
int i = 0, j = 0;
@@ -503,7 +503,7 @@ namespace Umbraco.Web.Routing
/// Redirecting to a different site root and/or culture will not pick the new site root nor the new culture.
/// As per legacy, if the redirect does not work, we just ignore it.
///
- private bool FollowInternalRedirects(PublishedRequest request)
+ private bool FollowInternalRedirects(IPublishedRequest request)
{
if (request.PublishedContent == null)
throw new InvalidOperationException("There is no PublishedContent.");
@@ -565,7 +565,7 @@ namespace Umbraco.Web.Routing
/// Ensures that access to current node is permitted.
///
/// Redirecting to a different site root and/or culture will not pick the new site root nor the new culture.
- private void EnsurePublishedContentAccess(PublishedRequest request)
+ private void EnsurePublishedContentAccess(IPublishedRequest request)
{
if (request.PublishedContent == null)
throw new InvalidOperationException("There is no PublishedContent.");
@@ -635,7 +635,7 @@ namespace Umbraco.Web.Routing
///
/// Finds a template for the current node, if any.
///
- private void FindTemplate(PublishedRequest request)
+ private void FindTemplate(IPublishedRequest request)
{
// NOTE: at the moment there is only 1 way to find a template, and then ppl must
// use the Prepared event to change the template if they wish. Should we also
@@ -665,7 +665,7 @@ namespace Umbraco.Web.Routing
if (request.HasTemplate)
{
- _logger.Debug("FindTemplate: Has a template already, and no alternate template.");
+ _logger.Debug("FindTemplate: Has a template already, and no alternate template.");
return;
}
@@ -759,7 +759,7 @@ namespace Umbraco.Web.Routing
/// Follows external redirection through umbracoRedirect document property.
///
/// As per legacy, if the redirect does not work, we just ignore it.
- private void FollowExternalRedirect(PublishedRequest request)
+ private void FollowExternalRedirect(IPublishedRequest request)
{
if (request.HasPublishedContent == false) return;
diff --git a/src/Umbraco.Web/Routing/SiteDomainHelper.cs b/src/Umbraco.Web/Routing/SiteDomainHelper.cs
index 6173dfb43c..35475ae292 100644
--- a/src/Umbraco.Web/Routing/SiteDomainHelper.cs
+++ b/src/Umbraco.Web/Routing/SiteDomainHelper.cs
@@ -266,7 +266,7 @@ namespace Umbraco.Web.Routing
return _qualifiedSites[current.Scheme] = _sites
.ToDictionary(
kvp => kvp.Key,
- kvp => kvp.Value.Select(d => new Uri(UriUtility.StartWithScheme(d, current.Scheme)).GetLeftPart(UriPartial.Authority)).ToArray()
+ kvp => kvp.Value.Select(d => new Uri(UriUtilityCore.StartWithScheme(d, current.Scheme)).GetLeftPart(UriPartial.Authority)).ToArray()
);
// .ToDictionary will evaluate and create the dictionary immediately
diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs
index ba7a42630a..b76dc569b8 100644
--- a/src/Umbraco.Web/Templates/TemplateRenderer.cs
+++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs
@@ -117,7 +117,7 @@ namespace Umbraco.Web.Templates
}
- private void ExecuteTemplateRendering(TextWriter sw, PublishedRequest request)
+ private void ExecuteTemplateRendering(TextWriter sw, IPublishedRequest request)
{
//NOTE: Before we used to build up the query strings here but this is not necessary because when we do a
// Server.Execute in the TemplateRenderer, we pass in a 'true' to 'preserveForm' which automatically preserves all current
@@ -172,7 +172,7 @@ namespace Umbraco.Web.Templates
return newWriter.ToString();
}
- private void SetNewItemsOnContextObjects(PublishedRequest request)
+ private void SetNewItemsOnContextObjects(IPublishedRequest request)
{
//now, set the new ones for this page execution
_httpContextAccessor.HttpContext.Items[Core.Constants.Conventions.Url.AltTemplate] = null;
@@ -182,7 +182,7 @@ namespace Umbraco.Web.Templates
///
/// Save all items that we know are used for rendering execution to variables so we can restore after rendering
///
- private void SaveExistingItems(out PublishedRequest oldPublishedRequest, out object oldAltTemplate)
+ private void SaveExistingItems(out IPublishedRequest oldPublishedRequest, out object oldAltTemplate)
{
//Many objects require that these legacy items are in the http context items... before we render this template we need to first
//save the values in them so that we can re-set them after we render so the rest of the execution works as per normal
@@ -193,7 +193,7 @@ namespace Umbraco.Web.Templates
///
/// Restores all items back to their context's to continue normal page rendering execution
///
- private void RestoreItems(PublishedRequest oldPublishedRequest, object oldAltTemplate)
+ private void RestoreItems(IPublishedRequest oldPublishedRequest, object oldAltTemplate)
{
_umbracoContextAccessor.UmbracoContext.PublishedRequest = oldPublishedRequest;
_httpContextAccessor.HttpContext.Items[Core.Constants.Conventions.Url.AltTemplate] = oldAltTemplate;
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 408951eba6..a2db94f9a5 100755
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -654,10 +654,8 @@
-
-
@@ -694,7 +692,6 @@
-
@@ -704,7 +701,6 @@
Code
-
diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs
index 07310e8a5c..8112b32263 100644
--- a/src/Umbraco.Web/UmbracoContext.cs
+++ b/src/Umbraco.Web/UmbracoContext.cs
@@ -139,7 +139,7 @@ namespace Umbraco.Web
///
/// Gets/sets the PublishedRequest object
///
- public PublishedRequest PublishedRequest { get; set; }
+ public IPublishedRequest PublishedRequest { get; set; }
///
/// Exposes the HttpContext for the current request
diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs
index 8b840461d5..72579188ed 100644
--- a/src/Umbraco.Web/UmbracoInjectedModule.cs
+++ b/src/Umbraco.Web/UmbracoInjectedModule.cs
@@ -273,7 +273,7 @@ namespace Umbraco.Web
///
///
///
- private void RewriteToUmbracoHandler(HttpContextBase context, PublishedRequest pcr)
+ private void RewriteToUmbracoHandler(HttpContextBase context, IPublishedRequest pcr)
{
// NOTE: we do not want to use TransferRequest even though many docs say it is better with IIS7, turns out this is
// not what we need. The purpose of TransferRequest is to ensure that .net processes all of the rules for the newly
diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs
index 2ec4141f5a..6197e824f5 100644
--- a/src/Umbraco.Web/UmbracoModule.cs
+++ b/src/Umbraco.Web/UmbracoModule.cs
@@ -45,7 +45,7 @@ namespace Umbraco.Web
// returns a value indicating whether redirection took place and the request has
// been completed - because we don't want to Response.End() here to terminate
// everything properly.
- internal static bool HandleHttpResponseStatus(HttpContextBase context, PublishedRequest pcr, ILogger logger)
+ internal static bool HandleHttpResponseStatus(HttpContextBase context, IPublishedRequest pcr, ILogger logger)
{
var end = false;
var response = context.Response;
@@ -55,8 +55,8 @@ namespace Umbraco.Web
pcr.Is404 ? "true" : "false",
pcr.ResponseStatusCode);
- if(pcr.Cacheability != default)
- response.Cache.SetCacheability(pcr.Cacheability);
+ if(pcr.CacheabilityNoCache)
+ response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
foreach (var cacheExtension in pcr.CacheExtensions)
response.Cache.AppendCacheExtension(cacheExtension);
diff --git a/src/Umbraco.Web/UriUtility.cs b/src/Umbraco.Web/UriUtility.cs
index 9e94a4a20a..6093d3e55a 100644
--- a/src/Umbraco.Web/UriUtility.cs
+++ b/src/Umbraco.Web/UriUtility.cs
@@ -177,54 +177,6 @@ namespace Umbraco.Web
#endregion
- #region Uri string utilities
-
- public static bool HasScheme(string uri)
- {
- return uri.IndexOf("://") > 0;
- }
-
- public static string StartWithScheme(string uri)
- {
- return StartWithScheme(uri, null);
- }
-
- public static string StartWithScheme(string uri, string scheme)
- {
- return HasScheme(uri) ? uri : String.Format("{0}://{1}", scheme ?? Uri.UriSchemeHttp, uri);
- }
-
- public static string EndPathWithSlash(string uri)
- {
- var pos1 = Math.Max(0, uri.IndexOf('?'));
- var pos2 = Math.Max(0, uri.IndexOf('#'));
- var pos = Math.Min(pos1, pos2);
-
- var path = pos > 0 ? uri.Substring(0, pos) : uri;
- path = path.EnsureEndsWith('/');
-
- if (pos > 0)
- path += uri.Substring(pos);
-
- return path;
- }
-
- public static string TrimPathEndSlash(string uri)
- {
- var pos1 = Math.Max(0, uri.IndexOf('?'));
- var pos2 = Math.Max(0, uri.IndexOf('#'));
- var pos = Math.Min(pos1, pos2);
-
- var path = pos > 0 ? uri.Substring(0, pos) : uri;
- path = path.TrimEnd('/');
-
- if (pos > 0)
- path += uri.Substring(pos);
-
- return path;
- }
-
- #endregion
///
/// Returns an full url with the host, port, etc...