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
Version:
$Id: EngineServiceLink.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
EngineServiceLink(IRequestCycle cycle, String serviceName, String[] serviceContext, String[] serviceParameters, 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 specified 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 toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EngineServiceLink

public EngineServiceLink(IRequestCycle cycle,
                         String serviceName,
                         String[] serviceContext,
                         String[] serviceParameters,
                         boolean stateful)
Creates a new EngineServiceLink. A EngineServiceLink always names a service to be activated by the link, has an optional list of service context strings, an optional list of service parameter strings and may be stateful or stateless.

ServiceLink parameter strings may contain any characters.

ServiceLink context strings must be URL safe, and may not contain slash ('/') characters. Typically, only letters, numbers and simple punctuation ('.', '-', '_', ':') is recommended (no checks are currently made, however). Context strings are generally built from page names and component ids, which are limited to safe characters.

Parameters:
cycle - The IRequestCycle the EngineServiceLink is to be created for.
serviceName - The name of the service to be invoked by the EngineServiceLink.
serviceContext - an optional array of strings to be provided to the service to provide a context for executing the service. May be null or empty. Note: copied, not retained.
serviceParameters - An array of parameters, may be null or empty. Note: 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

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 specified 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.

Specified by:
getParameterValues in interface ILink

toString

public String toString()
Overrides:
toString in class Object