Klasse MappedTemplateLink

java.lang.Object
org.apache.turbine.services.pull.tools.TemplateLink
org.apache.turbine.services.urlmapper.MappedTemplateLink
Alle implementierten Schnittstellen:
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 $
Autor:
Dave Bryson, Jon S. Stevens, Henning P. Schmiedehausen, Quinton McCombs, Peter Courcoux
  • Konstruktordetails

  • Methodendetails

    • 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.

      Setzt außer Kraft:
      getAbsoluteLink in Klasse TemplateLink
      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.

      Setzt außer Kraft:
      getRelativeLink in Klasse TemplateLink
      Gibt zurück:
      A String with the built URL.