org.apache.turbine.util
Class ServerData

java.lang.Object
  extended byorg.apache.turbine.util.ServerData

public class ServerData
extends java.lang.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 534527 2007-05-02 16:10:59Z 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(java.lang.String serverName, int serverPort, java.lang.String serverScheme, java.lang.String scriptName, java.lang.String contextPath)
          Constructor.
 
Method Summary
 java.lang.Object clone()
          generates a new Object with the same values as this one.
 java.lang.String getContextPath()
          Get the context path.
 void getHostUrl(java.lang.StringBuffer url)
          Appends the Host URL to the supplied StringBuffer.
 java.lang.String getScriptName()
          Get the script name
 java.lang.String getServerName()
          Get the name of the server.
 int getServerPort()
          Get the server port.
 java.lang.String getServerScheme()
          Get the server scheme.
 void setContextPath(java.lang.String contextPath)
          Set the context path.
 void setScriptName(java.lang.String scriptName)
          Set the script name.
 void setServerName(java.lang.String serverName)
          Sets the cached serverName.
 void setServerPort(int serverPort)
          Sets the cached serverPort.
 void setServerScheme(java.lang.String serverScheme)
          Sets the cached serverScheme.
 java.lang.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(java.lang.String serverName,
                  int serverPort,
                  java.lang.String serverScheme,
                  java.lang.String scriptName,
                  java.lang.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 java.lang.Object clone()
generates a new Object with the same values as this one.

Returns:
A cloned object.

getServerName

public java.lang.String getServerName()
Get the name of the server.

Returns:
A String.

setServerName

public void setServerName(java.lang.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 java.lang.String getServerScheme()
Get the server scheme.

Returns:
the server scheme.

setServerScheme

public void setServerScheme(java.lang.String serverScheme)
Sets the cached serverScheme.

Parameters:
serverScheme - the server scheme.

getScriptName

public java.lang.String getScriptName()
Get the script name

Returns:
the script name.

setScriptName

public void setScriptName(java.lang.String scriptName)
Set the script name.

Parameters:
scriptName - the script name.

getContextPath

public java.lang.String getContextPath()
Get the context path.

Returns:
the context path.

setContextPath

public void setContextPath(java.lang.String contextPath)
Set the context path.

Parameters:
contextPath - A String.

getHostUrl

public void getHostUrl(java.lang.StringBuffer url)
Appends the Host URL to the supplied StringBuffer.

Parameters:
url - A StringBuffer object

toString

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

Returns:
The contents of this object as a String


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.