Klasse TemplateLink
- Alle implementierten Schnittstellen:
ApplicationTool
- Bekannte direkte Unterklassen:
MappedTemplateLink
$link.setPage("index.vm").addPathInfo("hello","world")
This would return: http://foo.com/Turbine/template/index.vm/hello/world
This is an application pull tool for the template system. You should not use it in a normal application!
- Version:
- $Id$
- Autor:
- Dave Bryson, Jon S. Stevens, Henning P. Schmiedehausen, Quinton McCombs, Peter Courcoux
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected Stringcache of the template name for getPage()static final booleanDefault Value for TEMPLATE_LINK_ENCODING_DEFAULTstatic final StringShould this tool add Container Encoding to the URIs returned?static final StringPrefix for Parameters for this toolstatic final booleanDefault Value for TEMPLATE_LINK_RELATIVE_KEYstatic final StringShould this tool return relative URIs or absolute?protected TemplateURITemplateURI used as backend for this objectprotected booleanDo we want a relative link? -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddPathInfo(String name, double value) Adds a name=value pair to the path_info string.addPathInfo(String name, int value) Adds a name=value pair to the path_info string.addPathInfo(String name, long value) Adds a name=value pair to the path_info string.addPathInfo(String name, Object value) Adds a name=value pair to the path_info string.addPathInfo(String name, String value) Adds a name=value pair to the path_info string.addPathInfo(org.apache.fulcrum.parser.ParameterParser pp) Adds a name=value pair for every entry in a ParameterParser object to the path_info string.addQueryData(String name, double value) Adds a name=value pair to the query string.addQueryData(String name, int value) Adds a name=value pair to the query string.addQueryData(String name, long value) Adds a name=value pair to the query string.addQueryData(String name, Object value) Adds a name=value pair to the query string.addQueryData(String name, String value) Adds a name=value pair to the query string.addQueryData(org.apache.fulcrum.parser.ParameterParser pp) Adds a name=value pair for every entry in a ParameterParser object to the query string.Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().Returns the absolute URI leaving the source intact.getLink()Returns the URI.getPage()Gets the template variable used by the Template Service.Returns the current reference anchor.Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().Returns the relative URI leaving the source intact.getURI()Returns the relative URI leaving the source intact.voidThis will initialize a TemplateLink object that was constructed with the default constructor (ApplicationTool method).voidrefresh()Refresh method - does nothingRemoves all the path info elements.removePathInfo(String name) Removes a name=value pair from the path info.Removes all the query string elements.removeQueryData(String name) Removes a name=value pair from the query string.Sets the action= value for this URL.setActionEvent(String action, String event) Sets the action= and eventSubmit= values for this URL.This will turn off the execution of res.encodeURL() by making res == null.Sets the template variable used by the Template Service.setReference(String reference) Sets a reference anchor (#ref).Sets the screen= value for this URL.toString()Same as getLink().
-
Felddetails
-
TEMPLATE_LINK_PREFIX
Prefix for Parameters for this tool- Siehe auch:
-
TEMPLATE_LINK_RELATIVE_KEY
Should this tool return relative URIs or absolute? Default: Absolute.- Siehe auch:
-
TEMPLATE_LINK_RELATIVE_DEFAULT
Default Value for TEMPLATE_LINK_RELATIVE_KEY- Siehe auch:
-
wantRelative
Do we want a relative link? -
TEMPLATE_LINK_ENCODING_KEY
Should this tool add Container Encoding to the URIs returned? True might cause trouble e.g. if you run with Apache HTTP Daemon / Tomcat Combo. Default is false (like Turbine 2.2)- Siehe auch:
-
TEMPLATE_LINK_ENCODING_DEFAULT
Default Value for TEMPLATE_LINK_ENCODING_DEFAULT- Siehe auch:
-
template
cache of the template name for getPage() -
templateURI
TemplateURI used as backend for this object
-
-
Konstruktordetails
-
TemplateLink
public TemplateLink()Default constructorThe init method must be called before use.
-
-
Methodendetails
-
init
This will initialize a TemplateLink object that was constructed with the default constructor (ApplicationTool method).- Angegeben von:
initin SchnittstelleApplicationTool- Parameter:
data- assumed to be a PipelineData object
-
refresh
Refresh method - does nothing- Angegeben von:
refreshin SchnittstelleApplicationTool
-
setEncodeURLOff
This will turn off the execution of res.encodeURL() by making res == null. This is a hack for cases where you don't want to see the session information- Gibt zurück:
- A
TemplateLink(self).
-
setPage
Sets the template variable used by the Template Service.- Parameter:
template- A String with the template name.- Gibt zurück:
- A TemplateLink.
-
getPage
Gets the template variable used by the Template Service. It is only available after setPage() has been called.- Gibt zurück:
- The template name.
-
setAction
Sets the action= value for this URL. By default it adds the information to the path_info instead of the query data.- Parameter:
action- A String with the action value.- Gibt zurück:
- A
TemplateLink(self).
-
setActionEvent
Sets the action= and eventSubmit= values for this URL. By default it adds the information to the path_info instead of the query data.- Parameter:
action- A String with the action value.event- A string with the event name.- Gibt zurück:
- A
TemplateLink(self).
-
setScreen
Sets the screen= value for this URL. By default it adds the information to the path_info instead of the query data.- Parameter:
screen- A String with the screen value.- Gibt zurück:
- A
TemplateLink(self).
-
setReference
Sets a reference anchor (#ref).- Parameter:
reference- A String containing the reference.- Gibt zurück:
- A
TemplateLink(self).
-
getReference
Returns the current reference anchor.- Gibt zurück:
- A String containing the reference.
-
addPathInfo
Adds a name=value pair for every entry in a ParameterParser object to the path_info string.- Parameter:
pp- A ParameterParser.- Gibt zurück:
- A
TemplateLink(self).
-
addPathInfo
Adds a name=value pair to the path_info string.- Parameter:
name- A String with the name to add.value- An Object with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addPathInfo
Adds a name=value pair to the path_info string.- Parameter:
name- A String with the name to add.value- A String with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addPathInfo
Adds a name=value pair to the path_info string.- Parameter:
name- A String with the name to add.value- A double with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addPathInfo
Adds a name=value pair to the path_info string.- Parameter:
name- A String with the name to add.value- An int with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addPathInfo
Adds a name=value pair to the path_info string.- Parameter:
name- A String with the name to add.value- A long with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair to the query string.- Parameter:
name- A String with the name to add.value- An Object with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair to the query string.- Parameter:
name- A String with the name to add.value- A String with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair to the query string.- Parameter:
name- A String with the name to add.value- A double with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair to the query string.- Parameter:
name- A String with the name to add.value- An int with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair to the query string.- Parameter:
name- A String with the name to add.value- A long with the value to add.- Gibt zurück:
- A
TemplateLink(self).
-
addQueryData
Adds a name=value pair for every entry in a ParameterParser object to the query string.- Parameter:
pp- A ParameterParser.- Gibt zurück:
- A
TemplateLink(self).
-
removePathInfo
Removes all the path info elements.- Gibt zurück:
- A
TemplateLink(self).
-
removePathInfo
Removes a name=value pair from the path info.- Parameter:
name- A String with the name to be removed.- Gibt zurück:
- A
TemplateLink(self).
-
removeQueryData
Removes all the query string elements.- Gibt zurück:
- A
TemplateLink(self).
-
removeQueryData
Removes a name=value pair from the query string.- Parameter:
name- A String with the name to be removed.- Gibt zurück:
- A
TemplateLink(self).
-
getAbsoluteLink
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). The resulting URL is absolute; it starts with http/https...TemplateURI tui = new TemplateURI (data, "UserScreen"); tui.addPathInfo("user","jon"); tui.getAbsoluteLink();The above call to absoluteLink() would return the String:http://www.server.com/servlets/Turbine/screen/UserScreen/user/jon
After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI. So you can use the $link reference multiple times on a page and start over with a fresh object every time.
- Gibt zurück:
- A String with the built URL.
-
getRelativeLink
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). The resulting URL is relative to the webserver root.TemplateURI tui = new TemplateURI (data, "UserScreen"); tui.addPathInfo("user","jon"); tui.getRelativeLink();The above call to relativeLink() would return the String:/servlets/Turbine/screen/UserScreen/user/jon
After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI. So you can use the $link reference multiple times on a page and start over with a fresh object every time.
- Gibt zurück:
- A String with the built URL.
-
getLink
Returns the URI. After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI.- Gibt zurück:
- A String with the URI in the form http://foo.com/Turbine/template/index.wm/hello/world
-
getURI
Returns the relative URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.Link or just $link, but does not reset the path_info and query data.- Gibt zurück:
- A String with the URI in the form http://foo.com/Turbine/template/index.wm/hello/world
-
getAbsoluteURI
Returns the absolute URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.AbsoluteLink but does not reset the path_info and query data.- Gibt zurück:
- A String with the URI in the form http://foo.com/Turbine/template/index.wm/hello/world
-
getRelativeURI
Returns the relative URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.RelativeLink but does not reset the path_info and query data.- Gibt zurück:
- A String with the URI in the form http://foo.com/Turbine/template/index.wm/hello/world
-
toString
Same as getLink().
-