org.apache.turbine.util.uri

## Class TemplateURI

- java.lang.Object
- - org.apache.turbine.util.uri.BaseURI
  - - org.apache.turbine.util.uri.TurbineURI
    - - org.apache.turbine.util.uri.TemplateURI

- All Implemented Interfaces:
    URI, URIConstants

      public class TemplateURI
      extends TurbineURI

  This class allows you to keep all the information needed for a single link at one place. It keeps your query data, path info, the server scheme, name, port and the script path. It is tuned for usage with a Template System e.g. Velocity. If you must generate a Turbine Link in a Template System, use this class.
  Version:
    $Id: TemplateURI.java 1071038 2011-02-15 20:32:27Z tv $
  Author:
    Henning P. Schmiedehausen

- - ### Field Summary

    - ### Fields inherited from interface org.apache.turbine.util.uri.URIConstants

      `CGI_ACTION_PARAM, CGI_SCREEN_PARAM, CGI_TEMPLATE_PARAM, EVENT_PREFIX, FTP_PORT, HTTP, HTTP_PORT, HTTPS, HTTPS_PORT, PATH_INFO, QUERY_DATA, URI_SCHEME_SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TemplateURI()` Empty C'tor.
    `TemplateURI(RunData runData)` Constructor with a RunData object
    `TemplateURI(RunData runData, boolean redirect)` Constructor, set explicit redirection
    `TemplateURI(RunData runData, String template)` Constructor, set Template
    `TemplateURI(RunData runData, String template, boolean redirect)` Constructor, set Template, set explicit redirection
    `TemplateURI(RunData runData, String template, String action)` Constructor, set Template and Action
    `TemplateURI(RunData runData, String template, String action, boolean redirect)` Constructor, set Template and Action, set explicit redirection
    `TemplateURI(ServerData serverData)` Constructor with a ServerData object
    `TemplateURI(ServerData serverData, boolean redirect)` Constructor, set explicit redirection
    `TemplateURI(ServerData serverData, String template)` Constructor, set Template
    `TemplateURI(ServerData serverData, String template, boolean redirect)` Constructor, set Template, set explicit redirection
    `TemplateURI(ServerData serverData, String template, String action)` Constructor, set Template and Action
    `TemplateURI(ServerData serverData, String template, String action, boolean redirect)` Constructor, set Template and Action, set explicit redirection
    `TemplateURI(String template, String action)` Constructor, user Turbine.getDefaultServerData(), set Template and Action

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `add(int type, org.apache.fulcrum.parser.ParameterParser pp)` Method for a quick way to add all the parameters in a ParameterParser.
    `void` | `clearTemplate()` Clears the template= value for this URL.
    `void` | `setTemplate(String template)` Sets the template= value for this URL.

    - ### Methods inherited from class org.apache.turbine.util.uri.TurbineURI

      `add, add, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addPathInfo, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, addQueryData, clearAction, clearResponse, clearScreen, getAbsoluteLink, getPathInfo, getQueryData, getRelativeLink, hasPathInfo, hasQueryData, remove, removePathInfo, removePathInfo, removeQueryData, removeQueryData, setAction, setActionEvent, setEvent, setPathInfo, setQueryData, setScreen, toString`

    - ### Methods inherited from class org.apache.turbine.util.uri.BaseURI

      `encodeResponse, getContextAndScript, getContextPath, getReference, getResponse, getSchemeAndPort, getScriptName, getServerName, getServerPort, getServerScheme, hasReference, isRedirect, setContextPath, setRedirect, setReference, setResponse, setScriptName, setSecure, setSecure, setServerName, setServerPort, setServerScheme`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TemplateURI

          public TemplateURI()

      Empty C'tor. Uses Turbine.getDefaultServerData().

    - #### TemplateURI

          public TemplateURI(RunData runData)

      Constructor with a RunData object
      Parameters:
        `runData` - A RunData object

    - #### TemplateURI

          public TemplateURI(RunData runData,
                     boolean redirect)

      Constructor, set explicit redirection
      Parameters:
        `runData` - A RunData object
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(RunData runData,
                     String template)

      Constructor, set Template
      Parameters:
        `runData` - A RunData object
        `template` - A Template Name

    - #### TemplateURI

          public TemplateURI(RunData runData,
                     String template,
                     boolean redirect)

      Constructor, set Template, set explicit redirection
      Parameters:
        `runData` - A RunData object
        `template` - A Template Name
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(RunData runData,
                     String template,
                     String action)

      Constructor, set Template and Action
      Parameters:
        `runData` - A RunData object
        `template` - A Template Name
        `action` - An Action Name

    - #### TemplateURI

          public TemplateURI(RunData runData,
                     String template,
                     String action,
                     boolean redirect)

      Constructor, set Template and Action, set explicit redirection
      Parameters:
        `runData` - A RunData object
        `template` - A Template Name
        `action` - An Action Name
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(ServerData serverData)

      Constructor with a ServerData object
      Parameters:
        `serverData` - A ServerData object

    - #### TemplateURI

          public TemplateURI(ServerData serverData,
                     boolean redirect)

      Constructor, set explicit redirection
      Parameters:
        `serverData` - A ServerData object
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(ServerData serverData,
                     String template)

      Constructor, set Template
      Parameters:
        `serverData` - A ServerData object
        `template` - A Template Name

    - #### TemplateURI

          public TemplateURI(ServerData serverData,
                     String template,
                     boolean redirect)

      Constructor, set Template, set explicit redirection
      Parameters:
        `serverData` - A ServerData object
        `template` - A Template Name
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(ServerData serverData,
                     String template,
                     String action)

      Constructor, set Template and Action
      Parameters:
        `serverData` - A ServerData object
        `template` - A Template Name
        `action` - An Action Name

    - #### TemplateURI

          public TemplateURI(ServerData serverData,
                     String template,
                     String action,
                     boolean redirect)

      Constructor, set Template and Action, set explicit redirection
      Parameters:
        `serverData` - A ServerData object
        `template` - A Template Name
        `action` - An Action Name
        `redirect` - True if redirection allowed.

    - #### TemplateURI

          public TemplateURI(String template,
                     String action)

      Constructor, user Turbine.getDefaultServerData(), set Template and Action
      Parameters:
        `template` - A Template Name
        `action` - An Action Name

  - ### Method Detail

    - #### setTemplate

          public void setTemplate(String template)

      Sets the template= value for this URL. By default it adds the information to the path_info instead of the query data. An empty value (null or "") cleans out an existing value.
      Parameters:
        `template` - A String with the template value.

    - #### clearTemplate

          public void clearTemplate()

      Clears the template= value for this URL.

    - #### add

          protected void add(int type,
                 org.apache.fulcrum.parser.ParameterParser pp)

      Method for a quick way to add all the parameters in a ParameterParser.

      If the type is P (0), then add name/value to the pathInfo hashtable.

      If the type is Q (1), then add name/value to the queryData hashtable.

      Overrides:
        `add` in class `TurbineURI`
      Parameters:
        `type` - Type of insertion (@see #add(char type, String name, String value))
        `pp` - A ParameterParser.

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.