Package org.apache.turbine.util
Class ServerData
- java.lang.Object
-
- org.apache.turbine.util.ServerData
-
public class ServerData extends Object
Holds basic server information under which Turbine is running. This class is accessable via the RunData object within the Turbine system. You can also use it as a placeholder for this information if you are only emulating a servlet system.- Version:
- $Id$
- Author:
- Kevin A. Burton, Jon S. Stevens, Henning P. Schmiedehausen
-
-
Constructor Summary
Constructors Constructor Description ServerData(String serverName, int serverPort, String serverScheme, String scriptName, String contextPath)
Constructor.ServerData(HttpServletRequest req)
A C'tor that takes a HTTP Request object and builds the server data from its contentsServerData(ServerData serverData)
Copy-Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
generates a new Object with the same values as this one.String
getContextPath()
Get the context path.void
getHostUrl(StringBuilder url)
Appends the Host URL to the supplied StringBuilder.String
getScriptName()
Get the script nameString
getServerName()
Get the name of the server.int
getServerPort()
Get the server port.String
getServerScheme()
Get the server scheme.void
setContextPath(String contextPath)
Set the context path.void
setScriptName(String scriptName)
Set the script name.void
setServerName(String serverName)
Sets the cached serverName.void
setServerPort(int serverPort)
Sets the cached serverPort.void
setServerScheme(String serverScheme)
Sets the cached serverScheme.String
toString()
Returns this object as an URL.
-
-
-
Constructor Detail
-
ServerData
public ServerData(String serverName, int serverPort, String serverScheme, String scriptName, String contextPath)
Constructor.- Parameters:
serverName
- The server name.serverPort
- The server port.serverScheme
- The server scheme.scriptName
- The script name.contextPath
- The context Path
-
ServerData
public ServerData(ServerData serverData)
Copy-Constructor- Parameters:
serverData
- A ServerData Object
-
ServerData
public ServerData(HttpServletRequest req)
A C'tor that takes a HTTP Request object and builds the server data from its contents- Parameters:
req
- The HTTP Request
-
-
Method Detail
-
getServerName
public String getServerName()
Get the name of the server.- Returns:
- A String.
-
setServerName
public void setServerName(String serverName)
Sets the cached serverName.- Parameters:
serverName
- the server name.
-
getServerPort
public int getServerPort()
Get the server port.- Returns:
- the server port.
-
setServerPort
public void setServerPort(int serverPort)
Sets the cached serverPort.- Parameters:
serverPort
- the server port.
-
getServerScheme
public String getServerScheme()
Get the server scheme.- Returns:
- the server scheme.
-
setServerScheme
public void setServerScheme(String serverScheme)
Sets the cached serverScheme.- Parameters:
serverScheme
- the server scheme.
-
getScriptName
public String getScriptName()
Get the script name- Returns:
- the script name.
-
setScriptName
public void setScriptName(String scriptName)
Set the script name.- Parameters:
scriptName
- the script name.
-
getContextPath
public String getContextPath()
Get the context path.- Returns:
- the context path.
-
setContextPath
public void setContextPath(String contextPath)
Set the context path.- Parameters:
contextPath
- A String.
-
getHostUrl
public void getHostUrl(StringBuilder url)
Appends the Host URL to the supplied StringBuilder.- Parameters:
url
- A StringBuilder object
-
-