Interface IPublishedRequestBuilder
Used by IContentFinder to route inbound requests to Umbraco content
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
public interface IPublishedRequestBuilder
Properties
View SourceAbsolutePathDecoded
Gets the URI decoded absolute path of the Uri
Declaration
string AbsolutePathDecoded { get; }
Property Value
Type | Description |
---|---|
System.String |
Culture
Gets the System.Globalization.CultureInfo assigned (if any)
Declaration
string Culture { get; }
Property Value
Type | Description |
---|---|
System.String |
Domain
Gets the DomainAndUri assigned (if any)
Declaration
DomainAndUri Domain { get; }
Property Value
Type | Description |
---|---|
DomainAndUri |
IsInternalRedirect
Gets a value indicating whether the current published content has been obtained from the initial published content following internal redirections exclusively.
Declaration
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 the current IPublishedContent assigned (if any)
Declaration
IPublishedContent PublishedContent { get; }
Property Value
Type | Description |
---|---|
IPublishedContent |
ResponseStatusCode
Gets the content request http response status code.
Declaration
int? ResponseStatusCode { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Template
Gets the template assigned to the request (if any)
Declaration
ITemplate Template { get; }
Property Value
Type | Description |
---|---|
ITemplate |
Uri
Gets the cleaned up inbound Uri used for routing.
Declaration
Uri Uri { get; }
Property Value
Type | Description |
---|---|
Uri |
Remarks
The cleaned up Uri has no virtual directory, no trailing slash, no .aspx extension, etc.
Methods
View SourceBuild()
Builds the IPublishedRequest
Declaration
IPublishedRequest Build()
Returns
Type | Description |
---|---|
IPublishedRequest |
IgnorePublishedContentCollisions()
Can be called to configure the IPublishedRequest result to ignore URL collisions
Declaration
void IgnorePublishedContentCollisions()
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.
SetCacheExtensions(IEnumerable<String>)
Sets a list of Extensions to append to the Response.Cache object.
Declaration
IPublishedRequestBuilder SetCacheExtensions(IEnumerable<string> cacheExtensions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | cacheExtensions |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
SetCulture(String)
Sets the culture for the request
Declaration
IPublishedRequestBuilder SetCulture(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
SetDomain(DomainAndUri)
Sets the domain for the request which also sets the culture
Declaration
IPublishedRequestBuilder SetDomain(DomainAndUri domain)
Parameters
Type | Name | Description |
---|---|---|
DomainAndUri | domain |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
SetHeaders(IReadOnlyDictionary<String, String>)
Sets a dictionary of Headers to append to the Response object.
Declaration
IPublishedRequestBuilder SetHeaders(IReadOnlyDictionary<string, string> headers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyDictionary<System.String, System.String> | headers |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
SetInternalRedirect(IPublishedContent)
Sets the requested content, following an internal redirect.
Declaration
IPublishedRequestBuilder SetInternalRedirect(IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The requested content. |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
Since this sets the content, it will clear the template
SetNoCacheHeader(Boolean)
Sets the no-cache value to the Cache-Control header
Declaration
IPublishedRequestBuilder SetNoCacheHeader(bool setHeader)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | setHeader | True to set the header, false to not set it |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
SetPublishedContent(IPublishedContent)
Sets the found IPublishedContent for the request
Declaration
IPublishedRequestBuilder SetPublishedContent(IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
Setting the content clears the template and redirect
SetRedirect(String, Int32)
Indicates that the content request should trigger a redirect, with a specified status code.
Declaration
IPublishedRequestBuilder SetRedirect(string url, int status = 302)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The url to redirect to. |
System.Int32 | status | The status code (300-308). |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
Does not actually perform a redirect, only registers that the response should redirect. Redirect will or will not take place in due time.
SetRedirectPermanent(String)
Indicates that the content request should trigger a permanent redirect (301).
Declaration
IPublishedRequestBuilder SetRedirectPermanent(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The url to redirect to. |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
Does not actually perform a redirect, only registers that the response should redirect. Redirect will or will not take place in due time.
SetResponseStatus(Int32)
Sets the http response status code, along with an optional associated description.
Declaration
IPublishedRequestBuilder SetResponseStatus(int code)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | code | The http status code. |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
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.
SetTemplate(ITemplate)
Sets the template to use to display the requested content.
Declaration
IPublishedRequestBuilder SetTemplate(ITemplate template)
Parameters
Type | Name | Description |
---|---|---|
ITemplate | template | The template. |
Returns
Type | Description |
---|---|
IPublishedRequestBuilder |
Remarks
Setting the template does refresh RenderingEngine
.
TrySetTemplate(String)
Tries to set the template to use to display the requested content.
Declaration
bool TrySetTemplate(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The alias of the template. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether a valid template with the specified alias was found. |
Remarks
Successfully setting the template does refresh RenderingEngine
.
If setting the template fails, then the previous template (if any) remains in place.