org.apache.tapestry5.internal.services
Class LinkImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.LinkImpl
All Implemented Interfaces:
Link

public class LinkImpl
extends Object
implements Link


Constructor Summary
LinkImpl(String absoluteURI, boolean optimizable, boolean forForm, Response response, RequestPathOptimizer optimizer)
           
 
Method Summary
 void addParameter(String parameterName, String value)
          Adds a parameter value.
 String getAnchor()
          Returns the link anchor.
 List<String> getParameterNames()
          Returns the names of any additional query parameters for the URI.
 String getParameterValue(String name)
          Returns the value of a specifically named query parameter, or null if no such query parameter is stored in the link.
 void setAnchor(String anchor)
          Sets the link anchor.
 String toAbsoluteURI()
          Converts the link to an absolute URI, a complete path, starting with a leading slash.
 String toRedirectURI()
          Returns the link as a redirect URI.
 String toString()
          Returns the value from toURI()
 String toURI()
          Returns the URI portion of the link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkImpl

public LinkImpl(String absoluteURI,
                boolean optimizable,
                boolean forForm,
                Response response,
                RequestPathOptimizer optimizer)
Method Detail

addParameter

public void addParameter(String parameterName,
                         String value)
Description copied from interface: Link
Adds a parameter value. The value will be added, as is, to the URL. In many cases, the value should be URL encoded via URLCodec.

Specified by:
addParameter in interface Link
Parameters:
parameterName - the name of the parameter to store
value - the value to store

getAnchor

public String getAnchor()
Description copied from interface: Link
Returns the link anchor. If this link does not have an anchor, this method returns null.

Specified by:
getAnchor in interface Link
Returns:
the link anchor

getParameterNames

public List<String> getParameterNames()
Description copied from interface: Link
Returns the names of any additional query parameters for the URI. Query parameters store less regular or less often used values that can not be expressed in the path. They also are used to store, or link to, persistent state.

Specified by:
getParameterNames in interface Link
Returns:
list of query parameter names, is alphabetical order

getParameterValue

public String getParameterValue(String name)
Description copied from interface: Link
Returns the value of a specifically named query parameter, or null if no such query parameter is stored in the link.

Specified by:
getParameterValue in interface Link
Returns:
the value of the named parameter

setAnchor

public void setAnchor(String anchor)
Description copied from interface: Link
Sets the link anchor. Null and empty anchors will be ignored when building the link URI.

Specified by:
setAnchor in interface Link
Parameters:
anchor - the link anchor

toAbsoluteURI

public String toAbsoluteURI()
Description copied from interface: Link
Converts the link to an absolute URI, a complete path, starting with a leading slash. This is necessary in many cases for client-side JavaScript that must send a request to application via XMLHttpRequest.

Specified by:
toAbsoluteURI in interface Link
Returns:
the complete URI (not abbreviated relative to the current request path)

toRedirectURI

public String toRedirectURI()
Description copied from interface: Link
Returns the link as a redirect URI. The URI includes any query parameters.

Specified by:
toRedirectURI in interface Link

toURI

public String toURI()
Description copied from interface: Link
Returns the URI portion of the link. When the link is created for a form, this will not include query parameters. This is the same value returned from toString(). In some circumstances, this may be a relative URI (relative to the current Request's URI).

Specified by:
toURI in interface Link
Returns:
the URI, ready to be added as an element attribute

toString

public String toString()
Returns the value from toURI()

Overrides:
toString in class Object


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