Script: Class dw.web.URLRedirectMgr

Class URLRedirectMgr

URLRedirect manager class. Methods in this class generate URLRedirects based on the current configuration for Static, Dynamic and URLRedirect mappings in Commerce Cloud Digital. Information used to calculate URLRedirects are determined from the current HTTP request. The URL which is used to find a redirect can be accessed with getRedirectOrigin().

Properties

redirect : URLRedirect Read Only

An URLRedirect object, containing a location and status. The redirect is calculated based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for the requested site.

redirectOrigin : String Read Only

The relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Constructor Summary

This class does not have a constructor, so you cannot create it directly.

Method Summary

static getRedirect() : URLRedirect

Returns an URLRedirect object, containing a location and status.

static getRedirectOrigin() : String

Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Method Detail

getRedirect

static getRedirect() : URLRedirect

Returns an URLRedirect object, containing a location and status. The redirect is calculated based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for the requested site.

Returns:

URLRedirect containing the location and status code, null in case of no redirect was found

getRedirectOrigin

static getRedirectOrigin() : String

Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in getRedirect() to calculate a redirect location for.

Returns:

relative origin url