org.apache.tapestry.engine
Class EngineServiceLink

java.lang.Object
  extended byorg.apache.tapestry.engine.EngineServiceLink
All Implemented Interfaces:
ILink

public class EngineServiceLink
extends java.lang.Object
implements ILink

A EngineServiceLink represents a possible action within the client web browser; either clicking a link or submitting a form, which is constructed primarily from the servlet path, with some additional query parameters. A full URL for the EngineServiceLink can be generated, or the query parameters for the EngineServiceLink can be extracted (separately from the servlet path). The latter case is used when submitting constructing forms.

Since:
3.0
Author:
Howard Lewis Ship

Constructor Summary
EngineServiceLink(IRequestCycle cycle, java.lang.String servletPath, java.lang.String encoding, org.apache.commons.codec.net.URLCodec codec, WebRequest request, java.util.Map parameters, boolean stateful)
          Creates a new EngineServiceLink.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EngineServiceLink

public EngineServiceLink(IRequestCycle cycle,
                         java.lang.String servletPath,
                         java.lang.String encoding,
                         org.apache.commons.codec.net.URLCodec codec,
                         WebRequest request,
                         java.util.Map parameters,
                         boolean stateful)
Creates a new EngineServiceLink.

Parameters:
cycle - The IRequestCycle  the EngineServiceLink is to be created for.
servletPath - The path used to invoke the Tapestry servlet.
codec - A codec for converting strings into URL-safe formats.
encoding - The output encoding for the request.
parameters - The query parameters to be encoded into the url. Keys are strings, values are null, string or array of string. The map is retained, not copied.
stateful - if true, the service which generated the EngineServiceLink is stateful and expects that the final URL will be passed through IRequestCycle.encodeURL(String).
Method Detail

getURL

public java.lang.String getURL()
Description copied from interface: ILink
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.

Specified by:
getURL in interface ILink
Returns:
the relative URL, with no anchor, but including query parameters.

getURL

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

Specified by:
getURL in interface ILink
Parameters:
anchor - if not null, appended to the URL
includeParameters - if true, parameters are included

getAbsoluteURL

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

Specified by:
getAbsoluteURL in interface ILink

getURL

public java.lang.String getURL(java.lang.String scheme,
                               java.lang.String server,
                               int port,
                               java.lang.String anchor,
                               boolean includeParameters)
Description copied from interface: ILink
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.

Specified by:
getURL in interface ILink
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
See Also:
ILink.getURL(String, boolean), ILink.getAbsoluteURL(String, String, int, String, boolean)

getAbsoluteURL

public java.lang.String getAbsoluteURL(java.lang.String scheme,
                                       java.lang.String server,
                                       int port,
                                       java.lang.String anchor,
                                       boolean includeParameters)
Description copied from interface: ILink
Returns the absolute URL as a String.

Specified by:
getAbsoluteURL in interface ILink
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

getParameterNames

public java.lang.String[] getParameterNames()
Description copied from interface: ILink
Returns an array of parameters names (in no alphabetical order).

Specified by:
getParameterNames in interface ILink
See Also:
ILink.getParameterValues(String)

getParameterValues

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

Specified by:
getParameterValues in interface ILink