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<HttpServletRequest> |
currentRequest
ThreadLocal storage for request.
|
private static ThreadLocal<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 HttpServletRequest |
getRequest()
Get the current
HttpServletRequest being serviced by the current thread. |
static HttpServletResponse |
getResponse()
Get the current
HttpServletResponse being serviced by the current thread. |
static void |
loadCurrent(HttpServletRequest request,
HttpServletResponse response)
Load the thread-local storage with the current request and response.
|
private static ThreadLocal<HttpServletRequest> currentRequest
private static ThreadLocal<HttpServletResponse> currentResponse
private HttpServletRequestResponseContext()
public static void loadCurrent(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response)
request - the current HttpServletRequestresponse - the current HttpServletResponsepublic static void clearCurrent()
@Nullable public static HttpServletRequest getRequest()
HttpServletRequest being serviced by the current thread.@Nullable public static HttpServletResponse getResponse()
HttpServletResponse being serviced by the current thread.Copyright © 1999–2015. All rights reserved.