public interface Link
Dispatcher
.
Query parameter values are kept separate from the path portion to support encoding those values into hidden form
fields (where appropriate).Modifier and Type | Method and Description |
---|---|
Link |
addParameter(java.lang.String parameterName,
java.lang.String value)
Adds a parameter value.
|
Link |
addParameterValue(java.lang.String parameterName,
java.lang.Object value)
Adds a parameter value as a value object; the value object is converted to a string via
ContextPathEncoder.encodeValue(Object) and the result is added via addParameter(String, String) . |
Link |
copyWithBasePath(java.lang.String basePath)
Creates a copy of this link that has the same parameters, anchor, and other attributes, but a different
base path.
|
java.lang.String |
getAnchor()
Returns the link anchor.
|
java.lang.String |
getBasePath()
Returns the completely unadorned base path.
|
java.util.List<java.lang.String> |
getParameterNames()
Returns the names of any additional query parameters for the URI.
|
java.lang.String |
getParameterValue(java.lang.String name)
Returns the value of a specifically named query parameter, or null if no such query parameter is stored
in the link.
|
java.lang.String[] |
getParameterValues(java.lang.String parameterName)
Returns the parameter values for the given name.
|
LinkSecurity |
getSecurity()
Returns the current security for this link, which reflects whether the targeted page is itself secure or insecure.
|
Link |
removeParameter(java.lang.String parameterName)
Removes a parameter value, which is occasionally useful when transforming a parameter into a portion of
the path.
|
Link |
setAnchor(java.lang.String anchor)
Sets the link anchor.
|
void |
setSecurity(LinkSecurity newSecurity)
Changes the link's security, which can be useful to force a link to be either secure or insecure
when normally it might not be.
|
java.lang.String |
toAbsoluteURI()
Returns the absolute URL, which includes the scheme, hostname and possibly port (as per
BaseURLSource.getBaseURL(boolean) ). |
java.lang.String |
toAbsoluteURI(boolean secure)
Returns either the secure or insecure URL, with complete scheme, hostname and possibly port (as per
BaseURLSource.getBaseURL(boolean) ). |
java.lang.String |
toRedirectURI()
Returns the link as a redirect URI.
|
java.lang.String |
toURI()
Returns the URI portion of the link.
|
java.util.List<java.lang.String> getParameterNames()
java.lang.String getParameterValue(java.lang.String name)
getParameterValues(java.lang.String)
.
If you use this method with a multivalued parameter, the value returned is equal to the first value in the
array returned by getParameterValues
.@IncompatibleChange(release="5.4", details="changed from void to Link") Link addParameter(java.lang.String parameterName, java.lang.String value)
URLCodec
.parameterName
- the name of the parameter to storevalue
- the value to store, a null or blank value is allowed (as of Tapestry 5.3)Link addParameterValue(java.lang.String parameterName, java.lang.Object value)
ContextPathEncoder.encodeValue(Object)
and the result is added via addParameter(String, String)
.
The Link object is returned for further configuration.@IncompatibleChange(release="5.4", details="changed from void to Link") Link removeParameter(java.lang.String parameterName)
java.lang.String getBasePath()
toURI()
), may append
an anchor or query parameters.Link copyWithBasePath(java.lang.String basePath)
java.lang.String toURI()
java.lang.String toRedirectURI()
java.lang.String getAnchor()
@IncompatibleChange(release="5.4", details="changed from void to Link") Link setAnchor(java.lang.String anchor)
anchor
- the link anchorjava.lang.String toAbsoluteURI()
BaseURLSource.getBaseURL(boolean)
).
By default, the scheme is chosen to match the security of the current request.
Note: the semantics of this method changed between Tapestry 5.1 and 5.2. Most code should use toString() or
toURI()
(which are equivalent) instead.java.lang.String toAbsoluteURI(boolean secure)
BaseURLSource.getBaseURL(boolean)
).@IncompatibleChange(release="5.4", details="LinkSecurity class moved from internal package to org.apache.tapestry5.") void setSecurity(LinkSecurity newSecurity)
newSecurity
- new security value, not null, typically LinkSecurity.FORCE_SECURE
or LinkSecurity.FORCE_INSECURE
@IncompatibleChange(release="5.4", details="LinkSecurity class moved from internal package to org.apache.tapestry5.") LinkSecurity getSecurity()
java.lang.String[] getParameterValues(java.lang.String parameterName)
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.