Package 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
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$
- 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 Description DataURI()
Empty C'tor.DataURI(RunData runData)
Constructor with a RunData objectDataURI(RunData runData, boolean redirect)
Constructor, set explicit redirectionDataURI(ServerData serverData)
Constructor with a ServerData objectDataURI(ServerData serverData, boolean redirect)
Constructor, set explicit redirection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
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 objectredirect
- 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 objectredirect
- 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.
-
-