Class HttpServletRequestResponseContext
java.lang.Object
net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext
Class which holds and makes available the current HTTP servlet request and response via ThreadLocal storage.
See also net.shibboleth.shared.spring.servlet.impl.RequestResponseContextFilter, a Java Servlet
Filter-based way to populate and clean up this context in a servlet container.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ThreadLocal<HttpServletRequest>ThreadLocal storage for request.private static final ThreadLocal<HttpServletResponse>ThreadLocal storage for response. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClear the current thread-local context instances.static HttpServletRequestGet the currentHttpServletRequestbeing serviced by the current thread.static HttpServletResponseGet the currentHttpServletResponsebeing serviced by the current thread.static voidloadCurrent(HttpServletRequest request, HttpServletResponse response) Load the thread-local storage with the current request and response.
-
Field Details
-
currentRequest
ThreadLocal storage for request. -
currentResponse
ThreadLocal storage for response.
-
-
Constructor Details
-
HttpServletRequestResponseContext
private HttpServletRequestResponseContext()Constructor.
-
-
Method Details
-
loadCurrent
public static void loadCurrent(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response) Load the thread-local storage with the current request and response.- Parameters:
request- the currentHttpServletRequestresponse- the currentHttpServletResponse
-
clearCurrent
public static void clearCurrent()Clear the current thread-local context instances. -
getRequest
Get the currentHttpServletRequestbeing serviced by the current thread.- Returns:
- the current request
-
getResponse
Get the currentHttpServletResponsebeing serviced by the current thread.- Returns:
- the current response
-