Class PublishedRequest
Inheritance
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
public class PublishedRequest : IPublishedRequest
Constructors
View SourcePublishedRequest(Uri, String, IPublishedContent, Boolean, ITemplate, DomainAndUri, String, String, Nullable<Int32>, Nullable<IReadOnlyList<String>>, Nullable<IReadOnlyDictionary<String, String>>, Boolean, Boolean)
Initializes a new instance of the PublishedRequest class.
Declaration
public PublishedRequest(Uri uri, string absolutePathDecoded, IPublishedContent publishedContent, bool isInternalRedirect, ITemplate template, DomainAndUri domain, string culture, string redirectUrl, int? responseStatusCode, IReadOnlyList<string>? cacheExtensions, IReadOnlyDictionary<string, string>? headers, bool setNoCacheHeader, bool ignorePublishedContentCollisions)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | |
System.String | absolutePathDecoded | |
IPublishedContent | publishedContent | |
System.Boolean | isInternalRedirect | |
ITemplate | template | |
DomainAndUri | domain | |
System.String | culture | |
System.String | redirectUrl | |
System.Nullable<System.Int32> | responseStatusCode | |
System.Nullable<IReadOnlyList<System.String>> | cacheExtensions | |
System.Nullable<IReadOnlyDictionary<System.String, System.String>> | headers | |
System.Boolean | setNoCacheHeader | |
System.Boolean | ignorePublishedContentCollisions |
Properties
View SourceAbsolutePathDecoded
Gets the URI decoded absolute path of the Uri
Declaration
public string AbsolutePathDecoded { get; }
Property Value
Type | Description |
---|---|
System.String |
CacheExtensions
Gets a list of Extensions to append to the Response.Cache object.
Declaration
public IReadOnlyList<string>? CacheExtensions { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IReadOnlyList<System.String>> |
Culture
Gets the content request's culture.
Declaration
public string Culture { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This will get mapped to a CultureInfo eventually but CultureInfo are expensive to create so we want to leave that up to the localization middleware to do. See https://github.com/dotnet/aspnetcore/blob/b795ac3546eb3e2f47a01a64feb3020794ca33bb/src/Middleware/Localization/src/RequestLocalizationMiddleware.cs#L165.
Domain
Gets the content request's domain.
Declaration
public DomainAndUri Domain { get; }
Property Value
Type | Description |
---|---|
DomainAndUri |
Remarks
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/".
Headers
Gets a dictionary of Headers to append to the Response object.
Declaration
public IReadOnlyDictionary<string, string>? Headers { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IReadOnlyDictionary<System.String, System.String>> |
IgnorePublishedContentCollisions
Gets a value indicating whether the Umbraco Backoffice should ignore a collision for this request.
Declaration
public bool IgnorePublishedContentCollisions { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This is an uncommon API used for edge cases with complex routing and would be used by developers to configure the request to disable collision checks in UrlProviderExtensions.
This flag is based on previous Umbraco versions but it is not clear how this flag can be set by developers since collission checking only occurs in the back office which is launched by Umbraco.Cms.Core.Routing.PublishedRouter.TryRouteRequest(Umbraco.Cms.Core.Routing.IPublishedRequestBuilder) for which events do not execute.
More can be read about this setting here: https://github.com/umbraco/Umbraco-CMS/pull/2148, https://issues.umbraco.org/issue/U4-10345 but it's still unclear how this was used.
IsInternalRedirect
Gets a value indicating whether the current published content has been obtained from the initial published content following internal redirections exclusively.
Declaration
public bool IsInternalRedirect { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Used by PublishedContentRequestEngine.FindTemplate() to figure out whether to apply the internal redirect or not, when content is not the initial content.
PublishedContent
Gets a value indicating the requested content.
Declaration
public IPublishedContent PublishedContent { get; }
Property Value
Type | Description |
---|---|
IPublishedContent |
RedirectUrl
Gets the url to redirect to, when the content request triggers a redirect.
Declaration
public string RedirectUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
ResponseStatusCode
Gets the content request http response status code.
Declaration
public int? ResponseStatusCode { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Remarks
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.
SetNoCacheHeader
Gets a value indicating whether the no-cache value should be added to the Cache-Control header
Declaration
public bool SetNoCacheHeader { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Template
Gets the template assigned to the request (if any)
Declaration
public ITemplate Template { get; }
Property Value
Type | Description |
---|---|
ITemplate |
Uri
Gets the cleaned up inbound Uri used for routing.
Declaration
public Uri Uri { get; }
Property Value
Type | Description |
---|---|
Uri |
Remarks
The cleaned up Uri has no virtual directory, no trailing slash, no .aspx extension, etc.