org.apache.turbine.util
Class ServerData

java.lang.Object
  extended by 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: ServerData.java 615328 2008-01-25 20:25:05Z tv $
Author:
Kevin A. Burton, Jon S. Stevens, Henning P. Schmiedehausen

Constructor Summary
ServerData(javax.servlet.http.HttpServletRequest req)
          A C'tor that takes a HTTP Request object and builds the server data from its contents
ServerData(ServerData serverData)
          Copy-Constructor
ServerData(String serverName, int serverPort, String serverScheme, String scriptName, String contextPath)
          Constructor.
 
Method Summary
 Object clone()
          generates a new Object with the same values as this one.
 String getContextPath()
          Get the context path.
 void getHostUrl(StringBuffer url)
          Appends the Host URL to the supplied StringBuffer.
 String getScriptName()
          Get the script name
 String 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.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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(javax.servlet.http.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

clone

public Object clone()
generates a new Object with the same values as this one.

Overrides:
clone in class Object
Returns:
A cloned object.

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(StringBuffer url)
Appends the Host URL to the supplied StringBuffer.

Parameters:
url - A StringBuffer object

toString

public String toString()
Returns this object as an URL.

Overrides:
toString in class Object
Returns:
The contents of this object as a String


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