public final class HttpServletRequestResponseContext extends Object
See also RequestResponseContextFilter
, which is a Java Servlet Filter
-based way
to populate and clean up this context in a servlet container.
Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<javax.servlet.http.HttpServletRequest> |
currentRequest
ThreadLocal storage for request.
|
private static ThreadLocal<javax.servlet.http.HttpServletResponse> |
currentResponse
ThreadLocal storage for response.
|
Modifier | Constructor and Description |
---|---|
private |
HttpServletRequestResponseContext()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
clearCurrent()
Clear the current thread-local context instances.
|
static javax.servlet.http.HttpServletRequest |
getRequest()
Get the current
HttpServletRequest being serviced by the current thread. |
static javax.servlet.http.HttpServletResponse |
getResponse()
Get the current
HttpServletResponse being serviced by the current thread. |
static void |
loadCurrent(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Load the thread-local storage with the current request and response.
|
private static ThreadLocal<javax.servlet.http.HttpServletRequest> currentRequest
private static ThreadLocal<javax.servlet.http.HttpServletResponse> currentResponse
private HttpServletRequestResponseContext()
public static void loadCurrent(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
request
- the current HttpServletRequest
response
- the current HttpServletResponse
public static void clearCurrent()
@Nullable public static javax.servlet.http.HttpServletRequest getRequest()
HttpServletRequest
being serviced by the current thread.@Nullable public static javax.servlet.http.HttpServletResponse getResponse()
HttpServletResponse
being serviced by the current thread.Copyright © 1999–2017. All rights reserved.