The Spring Framework

org.springframework.web.context.request
Class RequestContextHolder

java.lang.Object
  extended by org.springframework.web.context.request.RequestContextHolder

public abstract class RequestContextHolder
extends Object

Helper class to manage a thread-bound HttpServletRequest.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
RequestContextListener, RequestContextFilter

Constructor Summary
RequestContextHolder()
           
 
Method Summary
static RequestAttributes currentRequestAttributes()
          Return the RequestAttributes currently bound to the thread.
static RequestAttributes getRequestAttributes()
          Return the RequestAttributes currently bound to the thread.
static void setRequestAttributes(RequestAttributes accessor)
          Bind the given RequestAttributes to the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestContextHolder

public RequestContextHolder()
Method Detail

setRequestAttributes

public static void setRequestAttributes(RequestAttributes accessor)
Bind the given RequestAttributes to the current thread.

Parameters:
accessor - the RequestAttributes to expose

getRequestAttributes

public static RequestAttributes getRequestAttributes()
Return the RequestAttributes currently bound to the thread.

Returns:
the RequestAttributes currently bound to the thread, or null

currentRequestAttributes

public static RequestAttributes currentRequestAttributes()
                                                  throws IllegalStateException
Return the RequestAttributes currently bound to the thread.

Returns:
the RequestAttributes currently bound to the thread
Throws:
IllegalStateException - if no RequestAttributes is bound to the current thread

The Spring Framework

Copyright © 2002-2006 The Spring Framework.