Class ServletRequestContextManager
- java.lang.Object
-
- nl.talsmasoftware.context.servletrequest.ServletRequestContextManager
-
- All Implemented Interfaces:
ContextManager<ServletRequest>
public final class ServletRequestContextManager extends Object implements ContextManager<ServletRequest>
Manager to propagate a currentServletRequestwith.- Author:
- Sjoerd Talsma
-
-
Constructor Summary
Constructors Constructor Description ServletRequestContextManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclear()Unconditionally removes the active context (and any parents).static ServletRequestcurrentServletRequest()Static utility method to obtain the currentServletRequest(if available).Context<ServletRequest>getActiveContext()The currently active context, ornullif no context is active.Context<ServletRequest>initializeNewContext(ServletRequest value)Initialize a new context containing the specifiedvalue.StringtoString()
-
-
-
Method Detail
-
currentServletRequest
public static ServletRequest currentServletRequest()
Static utility method to obtain the currentServletRequest(if available).- Returns:
- The current ServletRequest if available, or
nullotherwise.
-
initializeNewContext
public Context<ServletRequest> initializeNewContext(ServletRequest value)
Description copied from interface:ContextManagerInitialize a new context containing the specifiedvalue.Whether the value is allowed to be
nullis up to the implementation.- Specified by:
initializeNewContextin interfaceContextManager<ServletRequest>- Parameters:
value- The value to initialize a new context for.- Returns:
- The new active context containing the specified value which should be closed by the caller at the end of its lifecycle.
-
getActiveContext
public Context<ServletRequest> getActiveContext()
Description copied from interface:ContextManagerThe currently active context, ornullif no context is active.- Specified by:
getActiveContextin interfaceContextManager<ServletRequest>- Returns:
- The active context or
nullif there is none.
-
clear
public static void clear()
Unconditionally removes the active context (and any parents).This is useful for boundary filters, whose Threads may be returned to some threadpool.
-
-