Class SimpleAddressHandler
URL handler implementation for "simple address to page"
Implements
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class SimpleAddressHandler : CachedUrlHandler, IHandleUrlForRewrite
Constructors
SimpleAddressHandler(IContentRepository, Func<UrlBuilder, Object>)
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>)
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
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 |
|
Remarks
If a URL is handled, then it is always rewritten. I e this implementation will always return True.
Methods
RewriteFromCachedData(UrlRewriteContext, ref Object)
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)
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.