nextapp.echoservlet.util
Class EchoServletSupport

java.lang.Object
  extended by nextapp.echoservlet.util.EchoServletSupport

public class EchoServletSupport
extends java.lang.Object

Helper class that allows servlet details to become implicit by using ThreadLocal storage for them.


Constructor Summary
EchoServletSupport()
           
 
Method Summary
static Connection getConnection()
           
static java.lang.String getDirectRemoteHost()
          Retrieve the remote IP address.
static java.lang.String getRemoteHost()
          Retrieve the remote IP address.
static javax.servlet.http.HttpServletRequest getRequest()
           
static java.lang.Object getRequestAttribute(java.lang.String attribute)
          Convenience method to get a request attribute
static java.lang.String getRequestHeader(java.lang.String name)
          Retrieve a given request header, such as User-Agent to determine the browser type...
static java.lang.String getRequestParameter(java.lang.String parameter)
          Convenience method to get to request parameters.
static java.lang.String[] getRequestParameterNames()
          Retrieves a list of request parameters.
static java.lang.String getRequestURI()
          Retrieve the request URI.
static javax.servlet.http.HttpServletResponse getResponse()
           
static javax.servlet.ServletConfig getServletConfig()
           
static javax.servlet.ServletContext getServletContext()
           
static javax.servlet.http.HttpSession getSession()
           
static java.lang.Object getSessionAttribute(java.lang.String attribute)
          Convenience method to get session attribute.
static java.lang.String getSessionId()
          Wrapper operation for accessing the session in a thread safe fashion.
static void removeSessionAttribute(java.lang.String attribute)
          Method to remove a session attribute.
static void setContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
static void setContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Connection conn)
           
static void setRequestAttribute(java.lang.String attribute, java.lang.Object value)
          Convenience method to bind a request attribute
static void setServletConfig(javax.servlet.ServletConfig config)
           
static void setServletContext(javax.servlet.ServletContext context)
           
static void setSessionAttribute(java.lang.String attribute, java.lang.Object value)
          Method to set a session attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EchoServletSupport

public EchoServletSupport()
Method Detail

setContext

public static void setContext(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)

setContext

public static void setContext(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp,
                              Connection conn)

getRequest

public static javax.servlet.http.HttpServletRequest getRequest()

getResponse

public static javax.servlet.http.HttpServletResponse getResponse()

getConnection

public static Connection getConnection()

getSession

public static javax.servlet.http.HttpSession getSession()

getServletContext

public static javax.servlet.ServletContext getServletContext()

setServletContext

public static void setServletContext(javax.servlet.ServletContext context)

getServletConfig

public static javax.servlet.ServletConfig getServletConfig()

setServletConfig

public static void setServletConfig(javax.servlet.ServletConfig config)

getSessionAttribute

public static java.lang.Object getSessionAttribute(java.lang.String attribute)
Convenience method to get session attribute.

Parameters:
attribute -
Returns:

setSessionAttribute

public static void setSessionAttribute(java.lang.String attribute,
                                       java.lang.Object value)
Method to set a session attribute. Keeps track of session attributes put by the application so it can clean out the all session attributes for the application not affecting the container or the frameworl

Parameters:
attribute -
value -

removeSessionAttribute

public static void removeSessionAttribute(java.lang.String attribute)
Method to remove a session attribute. Keeps track of session attributes put by the application and cleans out the this session attribute for the application.

Parameters:
attribute -
value -

getRequestParameter

public static java.lang.String getRequestParameter(java.lang.String parameter)
Convenience method to get to request parameters.

Parameters:
parameter -
Returns:

setRequestAttribute

public static void setRequestAttribute(java.lang.String attribute,
                                       java.lang.Object value)
Convenience method to bind a request attribute

Parameters:
attribute -
value -

getRequestAttribute

public static java.lang.Object getRequestAttribute(java.lang.String attribute)
Convenience method to get a request attribute

Parameters:
attribute -
Returns:

getRequestURI

public static java.lang.String getRequestURI()
Retrieve the request URI.

Returns:

getRequestHeader

public static java.lang.String getRequestHeader(java.lang.String name)
Retrieve a given request header, such as User-Agent to determine the browser type...

Parameters:
name -
Returns:

getRemoteHost

public static java.lang.String getRemoteHost()
Retrieve the remote IP address. If forwarded by proxy return X-Forwarded-For

Returns:

getDirectRemoteHost

public static java.lang.String getDirectRemoteHost()
Retrieve the remote IP address. It allways return the IP address on the other side of the request's TCP/IP connection !

Returns:

getSessionId

public static java.lang.String getSessionId()
Wrapper operation for accessing the session in a thread safe fashion.


getRequestParameterNames

public static java.lang.String[] getRequestParameterNames()
Retrieves a list of request parameters.

Returns: