public class TemplateLink extends Object implements ApplicationTool
$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!
Modifier and Type | Field and Description |
---|---|
protected String |
template
cache of the template name for getPage()
|
static String |
TEMPLATE_LINK_PREFIX
Prefix for Parameters for this tool
|
static boolean |
TEMPLATE_LINK_RELATIVE_DEFAULT
Default Value for TEMPLATE_LINK_RELATIVE_KEY
|
static String |
TEMPLATE_LINK_RELATIVE_KEY
Should this tool return relative URIs or absolute?
|
protected TemplateURI |
templateURI
TemplateURI used as backend for this object
|
protected boolean |
wantRelative
Do we want a relative link?
|
Constructor and Description |
---|
TemplateLink()
Default constructor
The init method must be called before use.
|
Modifier and Type | Method and Description |
---|---|
TemplateLink |
addPathInfo(org.apache.fulcrum.parser.ParameterParser pp)
Adds a name=value pair for every entry in a ParameterParser
object to the path_info string.
|
TemplateLink |
addPathInfo(String name,
double value)
Adds a name=value pair to the path_info string.
|
TemplateLink |
addPathInfo(String name,
int value)
Adds a name=value pair to the path_info string.
|
TemplateLink |
addPathInfo(String name,
long value)
Adds a name=value pair to the path_info string.
|
TemplateLink |
addPathInfo(String name,
Object value)
Adds a name=value pair to the path_info string.
|
TemplateLink |
addPathInfo(String name,
String value)
Adds a name=value pair to the path_info string.
|
TemplateLink |
addQueryData(org.apache.fulcrum.parser.ParameterParser pp)
Adds a name=value pair for every entry in a ParameterParser
object to the query string.
|
TemplateLink |
addQueryData(String name,
double value)
Adds a name=value pair to the query string.
|
TemplateLink |
addQueryData(String name,
int value)
Adds a name=value pair to the query string.
|
TemplateLink |
addQueryData(String name,
long value)
Adds a name=value pair to the query string.
|
TemplateLink |
addQueryData(String name,
Object value)
Adds a name=value pair to the query string.
|
TemplateLink |
addQueryData(String name,
String value)
Adds a name=value pair to the query string.
|
String |
getAbsoluteLink()
Builds the URL with all of the data URL-encoded as well as
encoded using HttpServletResponse.encodeUrl().
|
String |
getAbsoluteURI()
Returns the absolute URI leaving the source intact.
|
String |
getLink()
Returns the URI.
|
String |
getPage()
Gets the template variable used by the Template Service.
|
String |
getReference()
Returns the current reference anchor.
|
String |
getRelativeLink()
Builds the URL with all of the data URL-encoded as well as
encoded using HttpServletResponse.encodeUrl().
|
String |
getRelativeURI()
Returns the relative URI leaving the source intact.
|
String |
getURI()
Returns the relative URI leaving the source intact.
|
void |
init(Object data)
This will initialize a TemplateLink object that was
constructed with the default constructor (ApplicationTool
method).
|
void |
refresh()
Refresh method - does nothing
|
TemplateLink |
removePathInfo()
Removes all the path info elements.
|
TemplateLink |
removePathInfo(String name)
Removes a name=value pair from the path info.
|
TemplateLink |
removeQueryData()
Removes all the query string elements.
|
TemplateLink |
removeQueryData(String name)
Removes a name=value pair from the query string.
|
TemplateLink |
setAction(String action)
Sets the action= value for this URL.
|
TemplateLink |
setActionEvent(String action,
String event)
Sets the action= and eventSubmit= values for this URL.
|
TemplateLink |
setEncodeURLOff()
This will turn off the execution of res.encodeURL()
by making res == null.
|
TemplateLink |
setPage(String template)
Sets the template variable used by the Template Service.
|
TemplateLink |
setReference(String reference)
Sets a reference anchor (#ref).
|
TemplateLink |
setScreen(String screen)
Sets the screen= value for this URL.
|
String |
toString()
Same as getLink().
|
public static final String TEMPLATE_LINK_PREFIX
public static final String TEMPLATE_LINK_RELATIVE_KEY
public static final boolean TEMPLATE_LINK_RELATIVE_DEFAULT
protected boolean wantRelative
protected TemplateURI templateURI
public TemplateLink()
The init method must be called before use.
public void init(Object data)
init
in interface ApplicationTool
data
- assumed to be a PipelineData objectpublic void refresh()
refresh
in interface ApplicationTool
public TemplateLink setEncodeURLOff()
TemplateLink
(self).public TemplateLink setPage(String template)
template
- A String with the template name.public String getPage()
public TemplateLink setAction(String action)
action
- A String with the action value.TemplateLink
(self).public TemplateLink setActionEvent(String action, String event)
action
- A String with the action value.event
- A string with the event name.TemplateLink
(self).public TemplateLink setScreen(String screen)
screen
- A String with the screen value.TemplateLink
(self).public TemplateLink setReference(String reference)
reference
- A String containing the reference.TemplateLink
(self).public String getReference()
public TemplateLink addPathInfo(org.apache.fulcrum.parser.ParameterParser pp)
pp
- A ParameterParser.TemplateLink
(self).public TemplateLink addPathInfo(String name, Object value)
name
- A String with the name to add.value
- An Object with the value to add.TemplateLink
(self).public TemplateLink addPathInfo(String name, String value)
name
- A String with the name to add.value
- A String with the value to add.TemplateLink
(self).public TemplateLink addPathInfo(String name, double value)
name
- A String with the name to add.value
- A double with the value to add.TemplateLink
(self).public TemplateLink addPathInfo(String name, int value)
name
- A String with the name to add.value
- An int with the value to add.TemplateLink
(self).public TemplateLink addPathInfo(String name, long value)
name
- A String with the name to add.value
- A long with the value to add.TemplateLink
(self).public TemplateLink addQueryData(String name, Object value)
name
- A String with the name to add.value
- An Object with the value to add.TemplateLink
(self).public TemplateLink addQueryData(String name, String value)
name
- A String with the name to add.value
- A String with the value to add.TemplateLink
(self).public TemplateLink addQueryData(String name, double value)
name
- A String with the name to add.value
- A double with the value to add.TemplateLink
(self).public TemplateLink addQueryData(String name, int value)
name
- A String with the name to add.value
- An int with the value to add.TemplateLink
(self).public TemplateLink addQueryData(String name, long value)
name
- A String with the name to add.value
- A long with the value to add.TemplateLink
(self).public TemplateLink addQueryData(org.apache.fulcrum.parser.ParameterParser pp)
pp
- A ParameterParser.TemplateLink
(self).public TemplateLink removePathInfo()
TemplateLink
(self).public TemplateLink removePathInfo(String name)
name
- A String with the name to be removed.TemplateLink
(self).public TemplateLink removeQueryData()
TemplateLink
(self).public TemplateLink removeQueryData(String name)
name
- A String with the name to be removed.TemplateLink
(self).public String getAbsoluteLink()
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.
public String getRelativeLink()
TemplateURI tui = new TemplateURI (data, "UserScreen"); tui.addPathInfo("user","jon"); tui.getRelativeLink();The above call to absoluteLink() 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.
public String getLink()
public String getURI()
public String getAbsoluteURI()
public String getRelativeURI()
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.