Try our conversational search powered by Generative AI!

Class HierarchicalUrlHandler

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. An implementation of a URL handler that supports hierarchical URL:s (a k a Friendly URL:s)

Inheritance
System.Object
HierarchicalUrlHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web.Internal
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public class HierarchicalUrlHandler : CachedUrlHandler, IHandleUrlForRewrite

Constructors

HierarchicalUrlHandler(UrlBuilder, ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the HierarchicalUrlHandler class.

Declaration
public HierarchicalUrlHandler(UrlBuilder url, ContentReference cachedInternalObject)
Parameters
Type Name Description
UrlBuilder url

The URL.

ContentReference cachedInternalObject

The cached internal object.

HierarchicalUrlHandler(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the HierarchicalUrlHandler class.

Declaration
public HierarchicalUrlHandler(string friendlyUrlExtension)
Parameters
Type Name Description
System.String friendlyUrlExtension

The friendly URL extension.

HierarchicalUrlHandler(Uri, ContentReference)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the HierarchicalUrlHandler class for handling cached requests

Declaration
public HierarchicalUrlHandler(Uri cachedUri, ContentReference cachedInternalObject)
Parameters
Type Name Description
System.Uri cachedUri

The resolved URL

ContentReference cachedInternalObject

The data returned in internalObject, which is a page reference in this case.

Properties

FriendlyUrlExtension

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the friendly URL extension.

Declaration
public string FriendlyUrlExtension { get; }
Property Value
Type Description
System.String

The friendly URL extension.

UrlRewritten

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets a value indicating whether the URL was rewritten as a result of the TryHandleUrl method.

Declaration
public bool UrlRewritten { get; }
Property Value
Type Description
System.Boolean

true if URL was rewritten; otherwise, false.

Methods

GetFromStartByPath(String, String, IContentRepository)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Get a page based on URL as defined by the PageData.URLSegment. Try begin with both start page and root page.

Declaration
protected static IContent GetFromStartByPath(string path, string languageId, IContentRepository contentRepository)
Parameters
Type Name Description
System.String path

The friendly URL path to find a page for

System.String languageId

The language we prefer

IContentRepository contentRepository

The page repository.

Returns
Type Description
IContent

A PageData object that was found based on the URL, or NULL if not found

Remarks

A language branch prefix will always be scanned and if found used as a language selector for the returned page

GetReferenceBySegments(ContentReference, String[])

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content by segments.

Declaration
protected static ContentReference GetReferenceBySegments(ContentReference rootPageRef, string[] segments)
Parameters
Type Name Description
ContentReference rootPageRef

The root page ref.

System.String[] segments

The segments.

Returns
Type Description
ContentReference

The content as found by following the path of the segments

RewriteFromCachedData(UrlRewriteContext, ref Object)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Rewrites the URL from cached data.

Declaration
public override bool RewriteFromCachedData(UrlRewriteContext context, ref object internalObject)
Parameters
Type Name Description
UrlRewriteContext context

The context.

System.Object internalObject

The internal object.

Returns
Type Description
System.Boolean

True if the URL was rewritten, false otherwise.

Overrides
Remarks

You may optionally return an internal representation of the page in internalObject. This will usually be a PageReference, but you should always check the type and not assume that it is a PageReference since internalObject may contain anything depending on the actual CachedUrlHandler implementation.

RewriteHierarchicalUrl(UrlRewriteContext)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Rewrites the hierarchical URL.

Declaration
protected void RewriteHierarchicalUrl(UrlRewriteContext context)
Parameters
Type Name Description
UrlRewriteContext context

The context.

TransferQueryStringsToConvertedUrl(UrlBuilder, Uri)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Transfers the query strings to converted URL.

Declaration
protected static void TransferQueryStringsToConvertedUrl(UrlBuilder externalUrl, Uri internalUri)
Parameters
Type Name Description
UrlBuilder externalUrl

The external URL.

System.Uri internalUri

The internal URI.

TryHandleUrl(UrlRewriteContext, ref Object, ref CachedUrlHandler)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Tries to handle the URL gven in the context.

Declaration
public bool TryHandleUrl(UrlRewriteContext context, ref object internalObject, ref CachedUrlHandler handler)
Parameters
Type Name Description
UrlRewriteContext context

The context for the rewrite. Note that the URL of the context may be modified.

System.Object internalObject

The internal object representation.

CachedUrlHandler handler

The cached handler.

Returns
Type Description
System.Boolean

True if the URL was recognized and handled, False otherwise.

Remarks

If this method returns False (URL not handled), then the context, internalObject and handler should be unaffected.

If the method returns True (URL handled), then UrlRewritten will indicate if the context.Url property has been modified. The method may optionally return a CachedUrlHandler in the handler parameter in this case as well.

Returning a non-null value in handler is how you indicate that you have want to cache expensive url lookups and reuse for subsequent calls.

Implements

Extension Methods