Try our conversational search powered by Generative AI!

Class SimpleAddressHandler

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. URL handler implementation for "simple address to page"

Inheritance
System.Object
SimpleAddressHandler
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 SimpleAddressHandler : CachedUrlHandler, IHandleUrlForRewrite

Constructors

SimpleAddressHandler(IContentRepository, Func<UrlBuilder, Object>)

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

Declaration
public SimpleAddressHandler(IContentRepository contentRepository, Func<UrlBuilder, object> simpleAddressToInternal)
Parameters
Type Name Description
IContentRepository contentRepository

The IContentRepository to use.

System.Func<UrlBuilder, System.Object> simpleAddressToInternal

A function that converts a UrlBuilder to internal representation (in this case a PageReference).

Remarks

This constructor is used when crearing an instance to be used in the URL handler lookup chain.

SimpleAddressHandler(IContentRepository, Uri, Object, Func<UrlBuilder, Object>)

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

Declaration
public SimpleAddressHandler(IContentRepository contentRepository, Uri rewrittenUrl, object actualInternalObject, Func<UrlBuilder, object> simpleAddressToInternal)
Parameters
Type Name Description
IContentRepository contentRepository

The IContentRepository to use.

System.Uri rewrittenUrl

The rewritten URL.

System.Object actualInternalObject

The actual internal object.

System.Func<UrlBuilder, System.Object> simpleAddressToInternal

A function that converts a UrlBuilder to internal representation (in this case a PageReference).

Properties

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.

Remarks

If a URL is handled, then it is always rewritten. I e this implementation will always return True.

Methods

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

This implementation will always rewrite the URL and therefore always returns True.

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