| java.lang.Object org.apache.turbine.util.uri.BaseURI org.apache.turbine.util.uri.TurbineURI
All known Subclasses: org.apache.turbine.util.uri.TemplateURI,
TurbineURI | public class TurbineURI extends BaseURI (Code) | | 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.
If you must generate a Turbine Link, use this class.
author: Jon S. Stevens author: Jason van Zyl author: Henning P. Schmiedehausen version: $Id: TurbineURI.java 638205 2008-03-18 04:10:39Z seade $ |
Constructor Summary | |
public | TurbineURI() Empty C'tor. | public | TurbineURI(RunData runData) Constructor with a RunData object. | public | TurbineURI(RunData runData, boolean redirect) Constructor, set explicit redirection. | public | TurbineURI(RunData runData, String screen) Constructor, set Screen. | public | TurbineURI(RunData runData, String screen, boolean redirect) Constructor, set Screen, set explicit redirection. | public | TurbineURI(RunData runData, String screen, String action) Constructor, set Screen and Action. | public | TurbineURI(RunData runData, String screen, String action, boolean redirect) Constructor, set Screen and Action, set explicit redirection. | public | TurbineURI(ServerData serverData) Constructor with a ServerData object. | public | TurbineURI(ServerData serverData, boolean redirect) Constructor, set explicit redirection. | public | TurbineURI(ServerData serverData, String screen) Constructor, set Screen. | public | TurbineURI(ServerData serverData, String screen, boolean redirect) Constructor, set Screen, set explicit redirection. | public | TurbineURI(ServerData serverData, String screen, String action) Constructor, set Screen and Action. | public | TurbineURI(ServerData serverData, String screen, String action, boolean redirect) Constructor, set Screen and Action, set explicit redirection. | public | TurbineURI(String screen, String action) Constructor, user Turbine.getDefaultServerData(), set Screen and Action. |
Method Summary | |
protected void | add(int type, String name, String value) If the type is PATH_INFO, then add name/value to the pathInfo
hashtable. | protected void | add(int type, ParameterParser pp) Method for a quick way to add all the parameters in a
ParameterParser. | protected void | add(int type, List list) Method for a quick way to add all the parameters in a
List with URIParam objects. | public void | addPathInfo(ParameterParser pp) Adds a name=value pair for every entry in a ParameterParser
object to the path_info string. | public void | addPathInfo(List list) Adds an existing List of URIParam objects to
the path_info string. | public void | addPathInfo(String name, Object value) Adds a name=value pair to the path_info string. | public void | addPathInfo(String name, String value) Adds a name=value pair to the path_info string. | public void | addPathInfo(String name, double value) Adds a name=value pair to the path_info string. | public void | addPathInfo(String name, int value) Adds a name=value pair to the path_info string. | public void | addPathInfo(String name, long value) Adds a name=value pair to the path_info string. | public void | addQueryData(String name, Object value) Adds a name=value pair to the query string. | public void | addQueryData(String name, String value) Adds a name=value pair to the query string. | public void | addQueryData(String name, double value) Adds a name=value pair to the query string. | public void | addQueryData(String name, int value) Adds a name=value pair to the query string. | public void | addQueryData(String name, long value) Adds a name=value pair to the query string. | public void | addQueryData(ParameterParser pp) Adds a name=value pair for every entry in a ParameterParser
object to the query string. | public void | addQueryData(List list) Adds an existing List of URIParam objects to the query data. | public void | clearAction() Clears the action= value for this URL. | public void | clearResponse() Template Link and friends want to be able to turn the encoding
of the servlet container off. | public void | clearScreen() Clears the screen= value for this URL. | public String | getAbsoluteLink() Builds the URL with all of the data URL-encoded as well as
encoded using HttpServletResponse.encodeUrl(). | public List | getPathInfo() Gets the current Query Data List.
A List which contains all query data keys. | public List | getQueryData() Gets the current Query Data List.
A List which contains all query data keys. | public String | getRelativeLink() Builds the URL with all of the data URL-encoded as well as
encoded using HttpServletResponse.encodeUrl(). | public boolean | hasPathInfo() | public boolean | hasQueryData() | protected void | remove(int type, String name) If the type is P (0), then remove name/value from the
pathInfo hashtable. | public void | removePathInfo() Removes all the path info elements. | public void | removePathInfo(String name) Removes a name=value pair from the path info. | public void | removeQueryData() Removes all the query string elements. | public void | removeQueryData(String name) Removes a name=value pair from the query string. | public void | setAction(String action) Sets the action= value for this URL.
By default it adds the information to the path_info instead
of the query data. | public void | setActionEvent(String action, String event) Sets the action= and eventSubmit= values for this URL.
By default it adds the information to the path_info instead
of the query data. | public void | setEvent(String event) Sets the fired eventSubmit= value for this URL. | public void | setPathInfo(List pathInfo) Sets the Query Data List. | public void | setQueryData(List queryData) Sets the Query Data List. | public void | setScreen(String screen) Sets the screen= value for this URL.
By default it adds the information to the path_info instead
of the query data. | public String | toString() Simply calls getAbsoluteLink(). |
TurbineURI | public TurbineURI()(Code) | | Empty C'tor. Uses Turbine.getDefaultServerData().
|
TurbineURI | public TurbineURI(RunData runData)(Code) | | Constructor with a RunData object.
Parameters: runData - A RunData object |
TurbineURI | public TurbineURI(RunData runData, boolean redirect)(Code) | | Constructor, set explicit redirection.
Parameters: runData - A RunData object Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(RunData runData, String screen)(Code) | | Constructor, set Screen.
Parameters: runData - A RunData object Parameters: screen - A Screen Name |
TurbineURI | public TurbineURI(RunData runData, String screen, boolean redirect)(Code) | | Constructor, set Screen, set explicit redirection.
Parameters: runData - A RunData object Parameters: screen - A Screen Name Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(RunData runData, String screen, String action)(Code) | | Constructor, set Screen and Action.
Parameters: runData - A RunData object Parameters: screen - A Screen Name Parameters: action - An Action Name |
TurbineURI | public TurbineURI(RunData runData, String screen, String action, boolean redirect)(Code) | | Constructor, set Screen and Action, set explicit redirection.
Parameters: runData - A RunData object Parameters: screen - A Screen Name Parameters: action - An Action Name Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(ServerData serverData)(Code) | | Constructor with a ServerData object.
Parameters: serverData - A ServerData object |
TurbineURI | public TurbineURI(ServerData serverData, boolean redirect)(Code) | | Constructor, set explicit redirection.
Parameters: serverData - A ServerData object Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(ServerData serverData, String screen)(Code) | | Constructor, set Screen.
Parameters: serverData - A ServerData object Parameters: screen - A Screen Name |
TurbineURI | public TurbineURI(ServerData serverData, String screen, boolean redirect)(Code) | | Constructor, set Screen, set explicit redirection.
Parameters: serverData - A ServerData object Parameters: screen - A Screen Name Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(ServerData serverData, String screen, String action)(Code) | | Constructor, set Screen and Action.
Parameters: serverData - A ServerData object Parameters: screen - A Screen Name Parameters: action - An Action Name |
TurbineURI | public TurbineURI(ServerData serverData, String screen, String action, boolean redirect)(Code) | | Constructor, set Screen and Action, set explicit redirection.
Parameters: serverData - A ServerData object Parameters: screen - A Screen Name Parameters: action - An Action Name Parameters: redirect - True if redirection allowed. |
TurbineURI | public TurbineURI(String screen, String action)(Code) | | Constructor, user Turbine.getDefaultServerData(), set Screen and Action.
Parameters: screen - A Screen Name Parameters: action - An Action Name |
add | protected void add(int type, String name, String value)(Code) | | If the type is PATH_INFO, then add name/value to the pathInfo
hashtable.
If the type is QUERY_DATA, then add name/value to the queryData
hashtable.
Parameters: type - Type (PATH_INFO or QUERY_DATA) of insertion. Parameters: name - A String with the name to add. Parameters: value - A String with the value to add. |
add | protected void add(int type, ParameterParser pp)(Code) | | 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.
Parameters: type - Type of insertion (@see #add(char type, String name, String value)) Parameters: pp - A ParameterParser. |
add | protected void add(int type, List list)(Code) | | Method for a quick way to add all the parameters in a
List with URIParam objects.
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.
Parameters: type - Type of insertion (@see #add(char type, String name, String value)) Parameters: list - A List of URIParam objects |
addPathInfo | public void addPathInfo(ParameterParser pp)(Code) | | Adds a name=value pair for every entry in a ParameterParser
object to the path_info string.
Parameters: pp - A ParameterParser. |
addPathInfo | public void addPathInfo(List list)(Code) | | Adds an existing List of URIParam objects to
the path_info string.
Parameters: list - A list with URIParam objects. |
addPathInfo | public void addPathInfo(String name, Object value)(Code) | | Adds a name=value pair to the path_info string.
Parameters: name - A String with the name to add. Parameters: value - An Object with the value to add. |
addPathInfo | public void addPathInfo(String name, String value)(Code) | | Adds a name=value pair to the path_info string.
Parameters: name - A String with the name to add. Parameters: value - A String with the value to add. |
addPathInfo | public void addPathInfo(String name, double value)(Code) | | Adds a name=value pair to the path_info string.
Parameters: name - A String with the name to add. Parameters: value - A double with the value to add. |
addPathInfo | public void addPathInfo(String name, int value)(Code) | | Adds a name=value pair to the path_info string.
Parameters: name - A String with the name to add. Parameters: value - An int with the value to add. |
addPathInfo | public void addPathInfo(String name, long value)(Code) | | Adds a name=value pair to the path_info string.
Parameters: name - A String with the name to add. Parameters: value - A long with the value to add. |
addQueryData | public void addQueryData(String name, Object value)(Code) | | Adds a name=value pair to the query string.
Parameters: name - A String with the name to add. Parameters: value - An Object with the value to add. |
addQueryData | public void addQueryData(String name, String value)(Code) | | Adds a name=value pair to the query string.
Parameters: name - A String with the name to add. Parameters: value - A String with the value to add. |
addQueryData | public void addQueryData(String name, double value)(Code) | | Adds a name=value pair to the query string.
Parameters: name - A String with the name to add. Parameters: value - A double with the value to add. |
addQueryData | public void addQueryData(String name, int value)(Code) | | Adds a name=value pair to the query string.
Parameters: name - A String with the name to add. Parameters: value - An int with the value to add. |
addQueryData | public void addQueryData(String name, long value)(Code) | | Adds a name=value pair to the query string.
Parameters: name - A String with the name to add. Parameters: value - A long with the value to add. |
addQueryData | public void addQueryData(ParameterParser pp)(Code) | | Adds a name=value pair for every entry in a ParameterParser
object to the query string.
Parameters: pp - A ParameterParser. |
addQueryData | public void addQueryData(List list)(Code) | | Adds an existing List of URIParam objects to the query data.
Parameters: list - A list with URIParam objects. |
clearAction | public void clearAction()(Code) | | Clears the action= value for this URL.
|
clearResponse | public void clearResponse()(Code) | | Template Link and friends want to be able to turn the encoding
of the servlet container off. After calling this method,
the no encoding will happen any longer. If you think, that you
need this outside a template context, think again.
|
clearScreen | public void clearScreen()(Code) | | Clears the screen= value for this URL.
|
getAbsoluteLink | public String getAbsoluteLink()(Code) | | 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 absoluteLink() would return the String:
http://www.server.com/servlets/Turbine/screen/UserScreen/user/jon
A String with the built URL. |
getPathInfo | public List getPathInfo()(Code) | | Gets the current Query Data List.
A List which contains all query data keys. The keysare URIParam objects. |
getQueryData | public List getQueryData()(Code) | | Gets the current Query Data List.
A List which contains all query data keys. The keysare URIParam objects. |
getRelativeLink | public String getRelativeLink()(Code) | | 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 relativeLink() would return the String:
/servlets/Turbine/screen/UserScreen/user/jon
A String with the built URL. |
hasPathInfo | public boolean hasPathInfo()(Code) | | Is Path Info data set in this URI?
true if Path Info has values |
hasQueryData | public boolean hasQueryData()(Code) | | Is Query data set in this URI?
true if Query data has values |
remove | protected void remove(int type, String name)(Code) | | If the type is P (0), then remove name/value from the
pathInfo hashtable.
If the type is Q (1), then remove name/value from the
queryData hashtable.
Parameters: type - Type (P or Q) of removal. Parameters: name - A String with the name to be removed. |
removePathInfo | public void removePathInfo()(Code) | | Removes all the path info elements.
|
removePathInfo | public void removePathInfo(String name)(Code) | | Removes a name=value pair from the path info.
Parameters: name - A String with the name to be removed. |
removeQueryData | public void removeQueryData()(Code) | | Removes all the query string elements.
|
removeQueryData | public void removeQueryData(String name)(Code) | | Removes a name=value pair from the query string.
Parameters: name - A String with the name to be removed. |
setAction | public void setAction(String action)(Code) | | Sets the action= 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: action - A String with the action value. |
setActionEvent | public void setActionEvent(String action, String event)(Code) | | Sets the action= and eventSubmit= values for this URL.
By default it adds the information to the path_info instead
of the query data. An empty value (null or "") for the action cleans out
an existing value. An empty value (null or "") for the event has no
effect.
Parameters: action - A String with the action value. Parameters: event - A string with the event name. |
setEvent | public void setEvent(String event)(Code) | | Sets the fired eventSubmit= value for this URL.
Parameters: event - The event to fire. |
setPathInfo | public void setPathInfo(List pathInfo)(Code) | | Sets the Query Data List. Replaces the current query data list
with the one supplied. The list must contain only URIParam
objects!
Parameters: pathInfo - A List with new param objects. |
setQueryData | public void setQueryData(List queryData)(Code) | | Sets the Query Data List. Replaces the current query data list
with the one supplied. The list must contain only URIParam
objects!
Parameters: queryData - A List with new param objects. |
setScreen | public void setScreen(String screen)(Code) | | Sets the screen= 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: screen - A String with the screen value. |
toString | public String toString()(Code) | | Simply calls getAbsoluteLink(). You should not use this in your
code unless you have to. Use getAbsoluteLink.
This URI as a String |
|
|