Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.util.uri
Class DataURI

    java.lang.Object
      org.apache.turbine.util.uri.BaseURI
          org.apache.turbine.util.uri.DataURI

All Implemented Interfaces:
  URI, URIConstants

    public class DataURI

extends BaseURI
implements URIConstants

This class can convert a simple link into a turbine relative URL. It should be used to convert references for images, style sheets and similar references. The resulting links have no query data or path info. If you need this, use TurbineURI or TemplateURI.

Version:
  $Id: DataURI.java 938645 2010-04-27 20:57:51Z 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
`DataURI()` Empty C'tor.
`DataURI(RunData runData)` Constructor with a RunData object
`DataURI(RunData runData, boolean redirect)` Constructor, set explicit redirection
`DataURI(ServerData serverData)` Constructor with a ServerData object
`DataURI(ServerData serverData, boolean redirect)` Constructor, set explicit redirection

Method Summary
`void` | `clearResponse()` Content Tool wants to be able to turn the encoding of the servlet container off.
`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().
`String` | `toString()` toString() simply calls getAbsoluteLink.

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

### DataURI

    public DataURI()

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

### DataURI

    public DataURI(RunData runData)

  Constructor with a RunData object

  Parameters:
    `runData` - A RunData object

### DataURI

    public DataURI(RunData runData,
                   boolean redirect)

  Constructor, set explicit redirection

  Parameters:
    `runData` - A RunData object
    `redirect` - True if redirection allowed.

### DataURI

    public DataURI(ServerData serverData)

  Constructor with a ServerData object

  Parameters:
    `serverData` - A ServerData object

### DataURI

    public DataURI(ServerData serverData,
                   boolean redirect)

  Constructor, set explicit redirection

  Parameters:
    `serverData` - A ServerData object
    `redirect` - True if redirection allowed.

Method Detail

### clearResponse

    public void clearResponse()

  Content Tool wants to be able to turn the encoding of the servlet container off. After calling this method, the encoding will not happen any longer.

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

  ``

       TurbineURI tui = new TurbineURI (data, "UserScreen");
       tui.addPathInfo("user","jon");
       tui.getAbsoluteLink();

  The above call to getAbsoluteLink() would return the String:

  http://www.server.com/servlets/Turbine/screen/UserScreen/user/jon

  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.

  ``

       TurbineURI tui = new TurbineURI (data, "UserScreen");
       tui.addPathInfo("user","jon");
       tui.getRelativeLink();

  The above call to getRelativeLink() would return the String:

  /servlets/Turbine/screen/UserScreen/user/jon

  Returns:
    A String with the built URL.

### toString

    public String toString()

  toString() simply calls getAbsoluteLink. You should not use this in your code unless you have to. Use getAbsoluteLink.

  Overrides:
    `toString` in class `Object`
  Returns:
    This URI as a String

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.