net.sf.gwtspringrpc.http
Class HTTPObjectHolder

java.lang.Object
  extended by net.sf.gwtspringrpc.http.HTTPObjectHolder

public final class HTTPObjectHolder
extends Object

This class holds HTTP objects in static thread local instances so they can be accessed by dynamic proxies. It manages the following objects:

Since:
1.0
Author:
Mike Clemens

Field Summary
private static ThreadLocal requests
          The HttpServletRequest instances by thread
private static ThreadLocal responses
          The HttpServletResponse instances by thread
private static ThreadLocal servletConfigs
          The ServletConfig instances by thread
private static ThreadLocal servletContexts
          The ServletContext instances by thread
 
Constructor Summary
private HTTPObjectHolder()
          The default constructor is private since the HTTPObjectHolder class cannot be instantiated.
 
Method Summary
static void clear()
          Clears all entries for the current thread.
static HttpServletRequest getRequest()
          Retrieves the HttpServletRequest instance for this thread.
static HttpServletResponse getResponse()
          Retrieves the HttpServletResponse instance for this thread.
static ServletConfig getServletConfig()
          Retrieves the ServletConfig instance for this thread.
static ServletContext getServletContext()
          Retrieves the ServletContext instance for this thread.
static void setRequest(HttpServletRequest request)
          Sets the HttpServletRequest instance for this thread.
static void setResponse(HttpServletResponse response)
          Sets the HttpServletResponse instance for this thread.
static void setServletConfig(ServletConfig servletConfig)
          Sets the ServletConfig instance for this thread.
static void setServletContext(ServletContext servletContext)
          Sets the ServletContext instance for this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requests

private static ThreadLocal requests
The HttpServletRequest instances by thread


responses

private static ThreadLocal responses
The HttpServletResponse instances by thread


servletContexts

private static ThreadLocal servletContexts
The ServletContext instances by thread


servletConfigs

private static ThreadLocal servletConfigs
The ServletConfig instances by thread

Constructor Detail

HTTPObjectHolder

private HTTPObjectHolder()
The default constructor is private since the HTTPObjectHolder class cannot be instantiated.

Method Detail

getRequest

public static HttpServletRequest getRequest()
Retrieves the HttpServletRequest instance for this thread.

Returns:
The HttpServletRequest instance

setRequest

public static void setRequest(HttpServletRequest request)
Sets the HttpServletRequest instance for this thread.

Parameters:
request - The HttpServletRequest instance

getResponse

public static HttpServletResponse getResponse()
Retrieves the HttpServletResponse instance for this thread.

Returns:
The HttpServletResponse instance

setResponse

public static void setResponse(HttpServletResponse response)
Sets the HttpServletResponse instance for this thread.

Parameters:
response - The HttpServletResponse instance

getServletContext

public static ServletContext getServletContext()
Retrieves the ServletContext instance for this thread.

Returns:
The ServletContext instance

setServletContext

public static void setServletContext(ServletContext servletContext)
Sets the ServletContext instance for this thread.

Parameters:
servletContext - The ServletContext instance

getServletConfig

public static ServletConfig getServletConfig()
Retrieves the ServletConfig instance for this thread.

Returns:
The ServletConfig instance

setServletConfig

public static void setServletConfig(ServletConfig servletConfig)
Sets the ServletConfig instance for this thread.

Parameters:
servletConfig - The ServletConfig instance

clear

public static void clear()
Clears all entries for the current thread.