Class URLAction
dw.web
Class URLAction
Object
dw.web.URLAction
The class is needed for the URL creation within template processing. It represents a reference to a pipeline name and start node, usually used in a HREF or a FORM action. URLAction instances are usually passed to one of the methods in URLUtils in order to generate an appropriately constructed Commerce Cloud Digital URL. For example:

var urlAction : URLAction = new URLAction("SimplePipeline-Start", "SampleSite");
var url : URL = URLUtils.abs(false, urlAction1);
// url.toString() equals "http://" + request.httpHost + "/on/demandware.store/Sites-SampleSite-Site/default/SimplePipeline-Start"

Constructor Summary
URLAction(action : String)
Constructs an action for the current site and locale.
URLAction(action : String, siteName : String)
Constructs an action for the specified site and the current locale.
URLAction(action : String, siteName : String, locale : String)
Constructs an action for the specified site and locale.
URLAction(action : String, siteName : String, locale : String, hostName : String)
Constructs an URL action for the specified site, locale and hostname.
Method Summary
Constructor Detail
URLAction
public URLAction(action : String)
Constructs an action for the current site and locale.
Parameters:
action - the target pipeline/controller, e.g. 'Default-Start'

URLAction
public URLAction(action : String, siteName : String)
Constructs an action for the specified site and the current locale.
Parameters:
action - the target pipeline/controller, e.g. 'Default-Start'
siteName - the target site, e.g. 'SampleSite'

URLAction
public URLAction(action : String, siteName : String, locale : String)
Constructs an action for the specified site and locale.
Parameters:
action - the target pipeline/controller, e.g.: 'Default-Start'
siteName - the target site, e.g. 'SampleSite'
locale - the target locale, e.g. 'default'

URLAction
public URLAction(action : String, siteName : String, locale : String, hostName : String)
Constructs an URL action for the specified site, locale and hostname.

The hostname must be defined in the site alias settings. If no hostname is provided, the HTTP/HTTPS host defined in the site alias settings will be used. If no HTTP/HTTPS host is defined in the site alias settings, the hostname of the current request is used.

Parameters:
action - the target pipeline/controller, e.g.: 'Default-Start'
siteName - the target site, e.g. 'SampleSite'
locale - the target locale, e.g. 'default'
hostName - the host name, e.g. ‘www.shop.com'
Throws:
Exception - if hostName is not defined in site alias settings