|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.services.pull.tools.TemplateLink
This is a pull to to be used in Templates to convert links in Templates into the correct references. The pull service might insert this tool into the Context. in templates. Here's an example of its Velocity use:
$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!
Field Summary | |
static java.lang.String |
TEMPLATE_LINK_PREFIX
Prefix for Parameters for this tool |
static boolean |
TEMPLATE_LINK_RELATIVE_DEFAULT
Default Value for TEMPLATE_LINK_RELATIVE_KEY |
static java.lang.String |
TEMPLATE_LINK_RELATIVE_KEY
Should this tool return relative URIs or absolute? Default: Absolute. |
Constructor Summary | |
TemplateLink()
Default constructor |
Method Summary | |
TemplateLink |
addPathInfo(ParameterParser pp)
Adds a name=value pair for every entry in a ParameterParser object to the path_info string. |
TemplateLink |
addPathInfo(java.lang.String name,
double value)
Adds a name=value pair to the path_info string. |
TemplateLink |
addPathInfo(java.lang.String name,
int value)
Adds a name=value pair to the path_info string. |
TemplateLink |
addPathInfo(java.lang.String name,
long value)
Adds a name=value pair to the path_info string. |
TemplateLink |
addPathInfo(java.lang.String name,
java.lang.Object value)
Adds a name=value pair to the path_info string. |
TemplateLink |
addPathInfo(java.lang.String name,
java.lang.String value)
Adds a name=value pair to the path_info string. |
TemplateLink |
addQueryData(ParameterParser pp)
Adds a name=value pair for every entry in a ParameterParser object to the query string. |
TemplateLink |
addQueryData(java.lang.String name,
double value)
Adds a name=value pair to the query string. |
TemplateLink |
addQueryData(java.lang.String name,
int value)
Adds a name=value pair to the query string. |
TemplateLink |
addQueryData(java.lang.String name,
long value)
Adds a name=value pair to the query string. |
TemplateLink |
addQueryData(java.lang.String name,
java.lang.Object value)
Adds a name=value pair to the query string. |
TemplateLink |
addQueryData(java.lang.String name,
java.lang.String value)
Adds a name=value pair to the query string. |
java.lang.String |
getAbsoluteLink()
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). |
java.lang.String |
getAbsoluteURI()
Returns the absolute URI leaving the source intact. |
java.lang.String |
getLink()
Returns the URI. |
java.lang.String |
getPage()
Gets the template variable used by the Template Service. |
java.lang.String |
getReference()
Returns the current reference anchor. |
java.lang.String |
getRelativeLink()
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). |
java.lang.String |
getRelativeURI()
Returns the relative URI leaving the source intact. |
java.lang.String |
getURI()
Returns the relative URI leaving the source intact. |
void |
init(java.lang.Object data)
This will initialise 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(java.lang.String name)
Removes a name=value pair from the path info. |
TemplateLink |
removeQueryData()
Removes all the query string elements. |
TemplateLink |
removeQueryData(java.lang.String name)
Removes a name=value pair from the query string. |
TemplateLink |
setAction(java.lang.String action)
Sets the action= value for this URL. |
TemplateLink |
setActionEvent(java.lang.String action,
java.lang.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 |
setEvent(java.lang.String action)
Sets the eventSubmit_= value for this URL. |
TemplateLink |
setPage(java.lang.String template)
Sets the template variable used by the Template Service. |
TemplateLink |
setReference(java.lang.String reference)
Sets a reference anchor (#ref). |
TemplateLink |
setScreen(java.lang.String screen)
Sets the screen= value for this URL. |
java.lang.String |
toString()
Same as getLink(). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String TEMPLATE_LINK_PREFIX
public static final java.lang.String TEMPLATE_LINK_RELATIVE_KEY
public static final boolean TEMPLATE_LINK_RELATIVE_DEFAULT
Constructor Detail |
public TemplateLink()
The init method must be called before use.
Method Detail |
public void init(java.lang.Object data)
init
in interface ApplicationTool
data
- assumed to be a RunData objectpublic void refresh()
refresh
in interface ApplicationTool
public TemplateLink setEncodeURLOff()
TemplateLink
(self).public TemplateLink setPage(java.lang.String template)
template
- A String with the template name.
public java.lang.String getPage()
public TemplateLink setAction(java.lang.String action)
action
- A String with the action value.
TemplateLink
(self).public TemplateLink setActionEvent(java.lang.String action, java.lang.String event)
action
- A String with the action value.event
- A string with the event name.
TemplateLink
(self).public TemplateLink setEvent(java.lang.String action)
action
- A String with the event value.
TemplateLink
(self).public TemplateLink setScreen(java.lang.String screen)
screen
- A String with the screen value.
TemplateLink
(self).public TemplateLink setReference(java.lang.String reference)
reference
- A String containing the reference.
TemplateLink
(self).public java.lang.String getReference()
public TemplateLink addPathInfo(ParameterParser pp)
pp
- A ParameterParser.
TemplateLink
(self).public TemplateLink addPathInfo(java.lang.String name, java.lang.Object value)
name
- A String with the name to add.value
- An Object with the value to add.
TemplateLink
(self).public TemplateLink addPathInfo(java.lang.String name, java.lang.String value)
name
- A String with the name to add.value
- A String with the value to add.
TemplateLink
(self).public TemplateLink addPathInfo(java.lang.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(java.lang.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(java.lang.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(java.lang.String name, java.lang.Object value)
name
- A String with the name to add.value
- An Object with the value to add.
TemplateLink
(self).public TemplateLink addQueryData(java.lang.String name, java.lang.String value)
name
- A String with the name to add.value
- A String with the value to add.
TemplateLink
(self).public TemplateLink addQueryData(java.lang.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(java.lang.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(java.lang.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(ParameterParser pp)
pp
- A ParameterParser.
TemplateLink
(self).public TemplateLink removePathInfo()
TemplateLink
(self).public TemplateLink removePathInfo(java.lang.String name)
name
- A String with the name to be removed.
TemplateLink
(self).public TemplateLink removeQueryData()
TemplateLink
(self).public TemplateLink removeQueryData(java.lang.String name)
name
- A String with the name to be removed.
TemplateLink
(self).public java.lang.String getAbsoluteLink()
The above call to absoluteLink() would return the String:
TemplateURI tui = new TemplateURI (data, "UserScreen");
tui.addPathInfo("user","jon");
tui.getAbsoluteLink();
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 java.lang.String getRelativeLink()
The above call to absoluteLink() would return the String:
TemplateURI tui = new TemplateURI (data, "UserScreen");
tui.addPathInfo("user","jon");
tui.getRelativeLink();
/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 java.lang.String getLink()
public java.lang.String getURI()
public java.lang.String getAbsoluteURI()
public java.lang.String getRelativeURI()
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |