org.codehaus.plexus.summit.pull.tools
Class RelativeTemplateLink

java.lang.Object
  extended byorg.codehaus.plexus.summit.util.UriBuilder
      extended byorg.codehaus.plexus.summit.pull.tools.RelativeTemplateLink
All Implemented Interfaces:
RequestTool

public class RelativeTemplateLink
extends UriBuilder
implements RequestTool

A customized version of the RelativeDynamicUriBuilder to be used in Templates. Here's an example of its Velocity/WebMacro use:

$link.setPage("index.wm").addPathInfo("hello","world") This would return: /myapp/servlet/myapp/target/index.wm/hello/world

Version:
$Id: RelativeTemplateLink.java 2092 2005-06-06 16:31:27Z jvanzyl $
Author:
John D. McNally, see the authors of TemplateLink

Field Summary
private  java.lang.String target
          cache of the target name for getPage()
private static java.lang.String TEMPLATE_KEY
          the pathinfo key stored in the UriBuilder
 
Fields inherited from class org.codehaus.plexus.summit.util.UriBuilder
ANCHOR_STATIC_PART_LENGTH, data, HTTP, HTTPS, PATH_INFO, pathInfo, QUERY_DATA, queryData, redirect, res, ROLE
 
Constructor Summary
RelativeTemplateLink()
          Default constructor

The init method must be called before use.

 
Method Summary
 java.lang.String getPage()
          Gets the target variable used by the Template Service.
 java.lang.String getURI()
          Returns the URI leaving the source intact.
 void refresh()
          Refresh the application tool.
 RelativeTemplateLink setEncodeURLOff()
          This will turn off the execution of res.encodeURL() by making res == null.
 RelativeTemplateLink setPage(java.lang.String t)
          Sets the target variable used by the Template Service.
 void setRunData(RunData data)
          Initialize the RequestTool with RunData from the request.
 java.lang.String toString()
          Returns the URI.
 
Methods inherited from class org.codehaus.plexus.summit.util.UriBuilder
add, add, add, addPair, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, getA, getScriptName, getServerName, getServerPort, getServerScheme, hasPathInfo, hasQueryData, init, init, isEncodeUrl, isRelative, remove, removePairByName, removePathInfo, removePathInfo, removeQueryData, removeQueryData, renderPairs, renderPathInfo, renderPathInfo, renderQueryString, renderQueryString, setAction, setEncodeUrl, setRedirect, setRelative, setTarget, toString, toString, writeEncoded, writeFastEncoded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEMPLATE_KEY

private static final java.lang.String TEMPLATE_KEY
the pathinfo key stored in the UriBuilder

See Also:
Constant Field Values

target

private java.lang.String target
cache of the target name for getPage()

Constructor Detail

RelativeTemplateLink

public RelativeTemplateLink()
Default constructor

The init method must be called before use.

Method Detail

setEncodeURLOff

public RelativeTemplateLink 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


setPage

public RelativeTemplateLink setPage(java.lang.String t)
Sets the target variable used by the Template Service.

Parameters:
t - A String with the target name.
Returns:
A TemplateLink.

getPage

public java.lang.String getPage()
Gets the target variable used by the Template Service. It is only available after setPage() has been called.

Returns:
The target name.

toString

public java.lang.String toString()
Returns the URI. After rendering the URI, it clears the pathInfo and QueryString portions of the UriBuilder.

Overrides:
toString in class UriBuilder
Returns:
A String with the URI in the form http://foo.com/Turbine/target/index.wm/hello/world

getURI

public java.lang.String getURI()
Returns the URI leaving the source intact. Wraps directly to the UriBuilder.toString method of the superclass (avoiding the local toString implementation).

Returns:
A String with the URI in the form http://foo.com/Turbine/target/index.wm/hello/world

setRunData

public void setRunData(RunData data)
Description copied from interface: RequestTool
Initialize the RequestTool with RunData from the request.

Specified by:
setRunData in interface RequestTool
Parameters:
data - initialization data

refresh

public void refresh()
Description copied from interface: RequestTool
Refresh the application tool. This is necessary for development work where you probably want the tool to refresh itself if it is using configuration information that is typically cached after initialization

Specified by:
refresh in interface RequestTool