org.apache.tapestry.engine
Interface ILink

All Known Implementing Classes:
EngineServiceLink, StaticLink

public interface ILink

Define a link that may be generated as part of a page render. The vast majority of links are tied to servicesand are, in fact, callbacks. A small number, such as those generated by GenericLink component, are to arbitrary locations. In addition, ILink differentiates between the path portion of the link, and any query parameters encoded into a link, primarily to benefit Form, which needs to encode the query parameters as hidden form fields.

In addition, an ILink is responsible for passing constructed URLs through IRequestCycle.encodeURL(String) as needed.

Since:
3.0
Author:
Howard Lewis Ship

Method Summary
 java.lang.String getAbsoluteURL()
          Returns the absolute URL as a String, using default scheme, server and port, including parameters, and no anchor.
 java.lang.String getAbsoluteURL(java.lang.String scheme, java.lang.String server, int port, java.lang.String anchor, boolean includeParameters)
          Returns the absolute URL as a String.
 java.lang.String[] getParameterNames()
          Returns an array of parameters names (in no alphabetical order).
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values for the named parameter.
 java.lang.String getURL()
          Returns the relative URL as a String.
 java.lang.String getURL(java.lang.String anchor, boolean includeParameters)
          Returns the relative URL as a String.
 java.lang.String getURL(java.lang.String scheme, java.lang.String server, int port, java.lang.String anchor, boolean includeParameters)
          Returns the URL as either a local or absoluate URL, depending on whether any of the parameters are both non-null and mismatched against the incoming request.
 

Method Detail

getURL

public java.lang.String getURL()
Returns the relative URL as a String. A relative URL may include a leading slash, but omits the scheme, host and port portions of a full URL.

Returns:
the relative URL, with no anchor, but including query parameters.

getURL

public java.lang.String getURL(java.lang.String anchor,
                               boolean includeParameters)
Returns the relative URL as a String. This is used for most links.

Parameters:
anchor - if not null, appended to the URL
includeParameters - if true, parameters are included

getAbsoluteURL

public java.lang.String getAbsoluteURL()
Returns the absolute URL as a String, using default scheme, server and port, including parameters, and no anchor.


getAbsoluteURL

public java.lang.String getAbsoluteURL(java.lang.String scheme,
                                       java.lang.String server,
                                       int port,
                                       java.lang.String anchor,
                                       boolean includeParameters)
Returns the absolute URL as a String.

Parameters:
scheme - if not null, overrides the default scheme.
server - if not null, overrides the default server
port - if non-zero, overrides the default port
anchor - if not null, appended to the URL
includeParameters - if true, parameters are included

getURL

public java.lang.String getURL(java.lang.String scheme,
                               java.lang.String server,
                               int port,
                               java.lang.String anchor,
                               boolean includeParameters)
Returns the URL as either a local or absoluate URL, depending on whether any of the parameters are both non-null and mismatched against the incoming request.

Parameters:
scheme - if not null, overrides the default scheme.
server - if not null, overrides the default server
port - if non-zero, overrides the default port
anchor - if not null, appended to the URL
includeParameters - if true, parameters are included
Since:
4.0
See Also:
getURL(String, boolean), getAbsoluteURL(String, String, int, String, boolean)

getParameterNames

public java.lang.String[] getParameterNames()
Returns an array of parameters names (in no alphabetical order).

See Also:
getParameterValues(String)

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns the values for the named parameter. Will return null if the no value is defined for the parameter.