Search Results for

    Show / Hide Table of Contents
    View Source

    Class PublishedRequestBuilder

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Routing
    Assembly: Umbraco.Core.dll
    Syntax
    public class PublishedRequestBuilder : object, IPublishedRequestBuilder

    Constructors

    View Source

    PublishedRequestBuilder(Uri, IFileService)

    Initializes a new instance of the PublishedRequestBuilder class.

    Declaration
    public PublishedRequestBuilder(Uri uri, IFileService fileService)
    Parameters
    Type Name Description
    Uri uri
    IFileService fileService

    Properties

    View Source

    AbsolutePathDecoded

    Gets the URI decoded absolute path of the Uri

    Declaration
    public string AbsolutePathDecoded { get; }
    Property Value
    Type Description
    System.String
    View Source

    Culture

    Gets the assigned (if any)

    Declaration
    public string Culture { get; }
    Property Value
    Type Description
    System.String
    View Source

    Domain

    Gets the DomainAndUri assigned (if any)

    Declaration
    public DomainAndUri Domain { get; }
    Property Value
    Type Description
    DomainAndUri
    View Source

    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.

    View Source

    PublishedContent

    Gets the current IPublishedContent assigned (if any)

    Declaration
    public IPublishedContent PublishedContent { get; }
    Property Value
    Type Description
    IPublishedContent
    View Source

    ResponseStatusCode

    Gets the content request http response status code.

    Declaration
    public int? ResponseStatusCode { get; }
    Property Value
    Type Description
    System.Nullable<System.Int32>
    View Source

    Template

    Gets the template assigned to the request (if any)

    Declaration
    public ITemplate Template { get; }
    Property Value
    Type Description
    ITemplate
    View Source

    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.

    Methods

    View Source

    Build()

    Builds the IPublishedRequest

    Declaration
    public IPublishedRequest Build()
    Returns
    Type Description
    IPublishedRequest
    View Source

    IgnorePublishedContentCollisions()

    Can be called to configure the IPublishedRequest result to ignore URL collisions

    Declaration
    public 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 .

    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 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.

    View Source

    SetCacheExtensions(IEnumerable<String>)

    Sets a list of Extensions to append to the Response.Cache object.

    Declaration
    public IPublishedRequestBuilder SetCacheExtensions(IEnumerable<string> cacheExtensions)
    Parameters
    Type Name Description
    IEnumerable<System.String> cacheExtensions
    Returns
    Type Description
    IPublishedRequestBuilder
    View Source

    SetCulture(String)

    Sets the culture for the request

    Declaration
    public IPublishedRequestBuilder SetCulture(string culture)
    Parameters
    Type Name Description
    System.String culture
    Returns
    Type Description
    IPublishedRequestBuilder
    View Source

    SetDomain(DomainAndUri)

    Sets the domain for the request which also sets the culture

    Declaration
    public IPublishedRequestBuilder SetDomain(DomainAndUri domain)
    Parameters
    Type Name Description
    DomainAndUri domain
    Returns
    Type Description
    IPublishedRequestBuilder
    View Source

    SetHeaders(IReadOnlyDictionary<String, String>)

    Sets a dictionary of Headers to append to the Response object.

    Declaration
    public IPublishedRequestBuilder SetHeaders(IReadOnlyDictionary<string, string> headers)
    Parameters
    Type Name Description
    IReadOnlyDictionary<System.String, System.String> headers
    Returns
    Type Description
    IPublishedRequestBuilder
    View Source

    SetInternalRedirect(IPublishedContent)

    Sets the requested content, following an internal redirect.

    Declaration
    public 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

    View Source

    SetNoCacheHeader(Boolean)

    Sets the no-cache value to the Cache-Control header

    Declaration
    public IPublishedRequestBuilder SetNoCacheHeader(bool cacheability)
    Parameters
    Type Name Description
    System.Boolean cacheability
    Returns
    Type Description
    IPublishedRequestBuilder
    View Source

    SetPublishedContent(IPublishedContent)

    Sets the found IPublishedContent for the request

    Declaration
    public IPublishedRequestBuilder SetPublishedContent(IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content
    Returns
    Type Description
    IPublishedRequestBuilder
    Remarks

    Setting the content clears the template and redirect

    View Source

    SetRedirect(String, Int32)

    Indicates that the content request should trigger a redirect, with a specified status code.

    Declaration
    public IPublishedRequestBuilder SetRedirect(string url, int status = null)
    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.

    View Source

    SetRedirectPermanent(String)

    Indicates that the content request should trigger a permanent redirect (301).

    Declaration
    public 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.

    View Source

    SetResponseStatus(Int32)

    Sets the http response status code, along with an optional associated description.

    Declaration
    public 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.

    View Source

    SetTemplate(ITemplate)

    Sets the template to use to display the requested content.

    Declaration
    public IPublishedRequestBuilder SetTemplate(ITemplate template)
    Parameters
    Type Name Description
    ITemplate template

    The template.

    Returns
    Type Description
    IPublishedRequestBuilder
    Remarks

    Setting the template does refresh RenderingEngine.

    View Source

    TrySetTemplate(String)

    Tries to set the template to use to display the requested content.

    Declaration
    public 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.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • PublishedRequestBuilder(Uri, IFileService)
    • Properties
      • AbsolutePathDecoded
      • Culture
      • Domain
      • IsInternalRedirect
      • PublishedContent
      • ResponseStatusCode
      • Template
      • Uri
    • Methods
      • Build()
      • IgnorePublishedContentCollisions()
      • SetCacheExtensions(IEnumerable<String>)
      • SetCulture(String)
      • SetDomain(DomainAndUri)
      • SetHeaders(IReadOnlyDictionary<String, String>)
      • SetInternalRedirect(IPublishedContent)
      • SetNoCacheHeader(Boolean)
      • SetPublishedContent(IPublishedContent)
      • SetRedirect(String, Int32)
      • SetRedirectPermanent(String)
      • SetResponseStatus(Int32)
      • SetTemplate(ITemplate)
      • TrySetTemplate(String)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX