Class PublishedRouter
Provides the default IPublishedRouter implementation.
Inheritance
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
public class PublishedRouter : IPublishedRouter
Constructors
View SourcePublishedRouter(IOptionsMonitor<WebRoutingSettings>, ContentFinderCollection, IContentLastChanceFinder, IVariationContextAccessor, IProfilingLogger, ILogger<PublishedRouter>, IPublishedUrlProvider, IRequestAccessor, IPublishedValueFallback, IFileService, IContentTypeService, IUmbracoContextAccessor, IEventAggregator, IDomainCache)
Initializes a new instance of the PublishedRouter class.
Declaration
public PublishedRouter(IOptionsMonitor<WebRoutingSettings> webRoutingSettings, ContentFinderCollection contentFinders, IContentLastChanceFinder contentLastChanceFinder, IVariationContextAccessor variationContextAccessor, IProfilingLogger proflog, ILogger<PublishedRouter> logger, IPublishedUrlProvider publishedUrlProvider, IRequestAccessor requestAccessor, IPublishedValueFallback publishedValueFallback, IFileService fileService, IContentTypeService contentTypeService, IUmbracoContextAccessor umbracoContextAccessor, IEventAggregator eventAggregator, IDomainCache domainCache)
Parameters
Type | Name | Description |
---|---|---|
IOptionsMonitor<WebRoutingSettings> | webRoutingSettings | |
ContentFinderCollection | contentFinders | |
IContentLastChanceFinder | contentLastChanceFinder | |
IVariationContextAccessor | variationContextAccessor | |
IProfilingLogger | proflog | |
ILogger<PublishedRouter> | logger | |
IPublishedUrlProvider | publishedUrlProvider | |
IRequestAccessor | requestAccessor | |
IPublishedValueFallback | publishedValueFallback | |
IFileService | fileService | |
IContentTypeService | contentTypeService | |
IUmbracoContextAccessor | umbracoContextAccessor | |
IEventAggregator | eventAggregator | |
IDomainCache | domainCache |
Methods
View SourceCreateRequestAsync(Uri)
Creates a published request.
Declaration
public async Task<IPublishedRequestBuilder> CreateRequestAsync(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | The current request Uri. |
Returns
Type | Description |
---|---|
Task<IPublishedRequestBuilder> | A published request builder. |
RouteDomain(IPublishedRequestBuilder)
Finds the site root (if any) matching the http request, and updates the PublishedRequest and VariationContext accordingly.
This method is used for VirtualPage routing.
In this case we do not want to run the entire routing pipeline since ContentFinders are not needed here.
However, we do want to set the culture on VariationContext and PublishedRequest to the values specified by the domains.
Declaration
public bool RouteDomain(IPublishedRequestBuilder request)
Parameters
Type | Name | Description |
---|---|---|
IPublishedRequestBuilder | request | The request to update the culture on domain on |
Returns
Type | Description |
---|---|
System.Boolean | True if a domain was found otherwise false. |
RouteRequestAsync(IPublishedRequestBuilder, RouteRequestOptions)
Sends a IPublishedRequestBuilder through the routing pipeline and builds a result.
Declaration
public async Task<IPublishedRequest> RouteRequestAsync(IPublishedRequestBuilder builder, RouteRequestOptions options)
Parameters
Type | Name | Description |
---|---|---|
IPublishedRequestBuilder | builder | |
RouteRequestOptions | options | The options. |
Returns
Type | Description |
---|---|
Task<IPublishedRequest> | The built IPublishedRequest instance. |
UpdateRequestAsync(IPublishedRequest, IPublishedContent)
Updates the request to use the specified IPublishedContent item, or NULL
Declaration
public async Task<IPublishedRequest> UpdateRequestAsync(IPublishedRequest request, IPublishedContent publishedContent)
Parameters
Type | Name | Description |
---|---|---|
IPublishedRequest | request | The request. |
IPublishedContent | publishedContent | The published content. |
Returns
Type | Description |
---|---|
Task<IPublishedRequest> |
Remarks
This method is used for 2 cases:
- When the rendering content needs to change due to Public Access rules.
- When there is nothing to render due to circumstances such as no template files. In this case, NULL is used as the parameter.
This method is invoked when the pipeline decides it cannot render the request, for whatever reason, and wants to force it to be re-routed and rendered as if no document were found (404). This occurs if there is no template found and route hijacking was not matched. In that case it's the same as if there was no content which means even if there was content matched we want to run the request through the last chance finders.
UpdateVariationContext(Uri)
Finds the site root (if any) matching the http request, and updates the VariationContext accordingly.
Declaration
public bool UpdateVariationContext(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | The URI to resolve the domain from. |
Returns
Type | Description |
---|---|
System.Boolean | True if a domain was found, otherwise false. |
Remarks
This is used for VirtualPage routing.
This is required to set the culture on VariationContext to the values specified by the domains, before the FindContent method is called. In order to allow the FindContent implementer to correctly find content based off the culture. Before the PublishedRequest is built.