|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.context.request.RequestContextHolder
public abstract class RequestContextHolder
Holder class to expose the web request in the form of a thread-bound
RequestAttributes
object.
Use RequestContextListener
or
RequestContextFilter
to expose
the current web request. Note that
DispatcherServlet
and
DispatcherPortlet
already
expose the current request by default.
RequestContextListener
,
RequestContextFilter
,
DispatcherServlet
,
DispatcherPortlet
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 |
resetRequestAttributes()
Reset the RequestAttributes for the current thread. |
static void |
setRequestAttributes(RequestAttributes attributes)
Bind the given RequestAttributes to the current thread, not exposing it as inheritable for child threads. |
static void |
setRequestAttributes(RequestAttributes attributes,
boolean inheritable)
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 |
---|
public RequestContextHolder()
Method Detail |
---|
public static void resetRequestAttributes()
public static void setRequestAttributes(RequestAttributes attributes)
attributes
- the RequestAttributes to exposesetRequestAttributes(RequestAttributes, boolean)
public static void setRequestAttributes(RequestAttributes attributes, boolean inheritable)
attributes
- the RequestAttributes to exposeinheritable
- whether to expose the RequestAttributes as inheritable
for child threads (using an InheritableThreadLocal
)public static RequestAttributes getRequestAttributes()
null
if none boundpublic static RequestAttributes currentRequestAttributes() throws IllegalStateException
Exposes the previously bound RequestAttributes instance, if any. Falls back to the current JSF FacesContext, if any.
IllegalStateException
- if no RequestAttributes object
is bound to the current threadsetRequestAttributes(org.springframework.web.context.request.RequestAttributes)
,
ServletRequestAttributes
,
FacesRequestAttributes
,
FacesContext.getCurrentInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |