Class MappedTemplateLink
- java.lang.Object
-
- org.apache.turbine.services.pull.tools.TemplateLink
-
- org.apache.turbine.services.urlmapper.MappedTemplateLink
-
- All Implemented Interfaces:
ApplicationTool
public class MappedTemplateLink extends 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!
- Version:
- $Id: TemplateLink.java 1854688 2019-03-03 10:36:42Z tv $
- Author:
- Dave Bryson, Jon S. Stevens, Henning P. Schmiedehausen, Quinton McCombs, Peter Courcoux
-
-
Field Summary
-
Fields inherited from class org.apache.turbine.services.pull.tools.TemplateLink
template, TEMPLATE_LINK_PREFIX, TEMPLATE_LINK_RELATIVE_DEFAULT, TEMPLATE_LINK_RELATIVE_KEY, templateURI, wantRelative
-
-
Constructor Summary
Constructors Constructor Description MappedTemplateLink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAbsoluteLink()
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().String
getRelativeLink()
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().-
Methods inherited from class org.apache.turbine.services.pull.tools.TemplateLink
addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, getAbsoluteURI, getLink, getPage, getReference, getRelativeURI, getURI, init, refresh, removePathInfo, removePathInfo, removeQueryData, removeQueryData, setAction, setActionEvent, setEncodeURLOff, setPage, setReference, setScreen, toString
-
-
-
-
Constructor Detail
-
MappedTemplateLink
public MappedTemplateLink()
-
-
Method Detail
-
getAbsoluteLink
public String 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.
- Overrides:
getAbsoluteLink
in classTemplateLink
- Returns:
- A String with the built URL.
-
getRelativeLink
public String 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.
- Overrides:
getRelativeLink
in classTemplateLink
- Returns:
- A String with the built URL.
-
-