org.apache.tapestry.engine
Class EngineServiceLink

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

public class EngineServiceLink
extends 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, String servletPath, String encoding, URLCodec codec, WebRequest request, QueryParameterMap parameters, boolean stateful)
          Creates a new EngineServiceLink.
EngineServiceLink(String servletPath, String encoding, URLCodec codec, WebRequest request, QueryParameterMap parameters, boolean stateful)
          Creates a new EngineServiceLink.
 
Method Summary
 String getAbsoluteURL()
          Returns the absolute URL as a String, using default scheme, server and port, including parameters, and no anchor.
 String getAbsoluteURL(String scheme, String server, int port, String anchor, boolean includeParameters)
          Returns the absolute URL as a String.
 String[] getParameterNames()
          Returns an array of parameters names (in no alphabetical order).
 String[] getParameterValues(String name)
          Returns the values for the named parameter.
 String getURL()
          Returns the relative URL as a String.
 String getURL(String anchor, boolean includeParameters)
          Returns the relative URL as a String.
 String getURL(String scheme, String server, int port, 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(String servletPath,
                         String encoding,
                         URLCodec codec,
                         WebRequest request,
                         QueryParameterMap parameters,
                         boolean stateful)
Creates a new EngineServiceLink.

Parameters:
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).

EngineServiceLink

public EngineServiceLink(IRequestCycle cycle,
                         String servletPath,
                         String encoding,
                         URLCodec codec,
                         WebRequest request,
                         QueryParameterMap parameters,
                         boolean stateful)
Creates a new EngineServiceLink. Primarily used in portlet applications with the additional IRequestCycle parameter being used to encode asset urls.

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 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 String getURL(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 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 String getURL(String scheme,
                     String server,
                     int port,
                     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 String getAbsoluteURL(String scheme,
                             String server,
                             int port,
                             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 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 String[] getParameterValues(String name)
Description copied from interface: ILink
Returns the values for the named parameter. Will return null if no value is defined for the parameter.

Specified by:
getParameterValues in interface ILink


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.