The URLBuilder is a tool object to modify or build URLs.
It contains methods to modify any part of the URL and rebuilds the modified URL again with method build(). All data provided by methods that return parts of the URL is given back decoded. On building the URLs all parts will be encoded properly according to the set encoding.
The methods modifying/builder the URL all return the URLBuilder object again so that method calls can be chained (see examples).
Just like in URL generation in WebTML via <tml:url> the URLBuilder also supports two types of parameters on the URL: Regular URL parameters settable via setParameter() and Var Parameters that are encrypted and added as WebTML variable to the page behind the URL, settable via setVarParameter(). Both are organized completely separately with an own set of methods for each one.
|Allowed in script types||
|Properties and methods||
An example, creating an URLBuilder from a content URL of the current content, adding an URL Parameter an rebuilding it:
var builder = WGA.urlBuilder(contentURL());
Using method chaining this can also be expressed in a single elegant line: