<ao:url>

Manually establishes a URL context when automatic detection is not possible. The body of this tag, after trimming, is valid RFC 3986 URI or RFC 3987 IRI. The URL is modified in several ways to make things much easier to work with.

Before the first ? symbol, may contain characters in any language. This is more flexible than a strict URL format, these characters will be automatically encoded based on context.

After the first ?, however, the parameters must be properly URL encoded and contain only valid characters. It should not be escaped for (X)HTML, meaning that parameter separators should be "&" instead of "&amp;". The proper escaping/encoding will be performed based on the context of this tag.

In order to make relative paths predictable, relative paths are interpreted from the current JSP page.

In order to keep paths app-relative, if starts with a /, the context path will be prepended to the path.

In order to simplify things behind URL mapping schemes, the href is always written starting with '/'. This avoids any need to include any <ao:base> tags.

Depending on context, the URL will be passed through HttpServletResponse.encodeURL to add any URL-based session state. Session state will never be added to external links.

To support paths in different character sets, a Unicode to ASCII URI encoding is performed on every character that is not defined in RFC 3986: Reserved Characters. To avoid ambiguity, any dynamic parameters or anchors in the URL must have been correctly encoded by the caller.

Any attribute that has no namespace and begins with param. is added to the URL as a parameter. The parameter name is the part of the attribute name following param..

When a parameter value is null it is not added. When a parameter value is an Enum, the value is obtained via Enum.name(). If the value is an Iterable, Iterator, Enumeration, or array, then each non-null element is coerced to String as a separate parameter in iteration order. Otherwise, the value itself is coerced to String for the parameter value.

Nested <ao:param> or <ao:params> tags will add parameters after any provided as attributes.

When in a CSS context, such as nested within <ao:style>, the URL is surrounded by url("…") and fully encoded as a CSS URL.

The content type of this tag is text/url.

To establish a URL context less URL manipulation, see also <encoding:url>.

Tag Information

Tag Class: com.aoapps.taglib.UrlTag
TagExtraInfo Class: None
Body Content: scriptless
Display Name: None
Dynamic Attributes: true

Attributes

Name Required Evaluation Type Description
absolute No Runtime boolean

When true, generates an absolute URL. Defaults to false.

canonical No Runtime boolean

When true, will generate a Canonical URL. Canonical URLs should be used where per-user response URL rewriting (such as information added when cookies are disabled) should be avoided. Defaults to false.

addLastModified No Runtime String

If the URL represents a local resource, a parameter of "lastModified=#####" may be automatically added with the timestamp of the local resource to the nearest second. May be one of true, false, or auto. Defaults to auto.

In auto mode, last modified stamping may be disabled by the client with the X-com-aoapps-servlet-lastmodified-enabled: false header.

In auto mode, last modified stamping is not performed on Canonical URLs.

Variables

No Variables Defined.