java.lang.Object
io.jooby.RequestScope
Thread-Local request scope implementation useful for save/store request attribute and access to
them using a static way.
This is part of public API but usage must be keep to minimum.
- Author:
- edgar
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Binds the given value to the current context for its key.static <T> T
Get a previously bind value for the given key ornull
.static boolean
Check to see if there is already a value associated with the current thread for the given key.static ThreadLocal<Map<Object,
Object>> Exposes thread local state.static <T> T
Unbinds the session (if one) current associated with the context for the given session.
-
Method Details
-
hasBind
Check to see if there is already a value associated with the current thread for the given key.- Parameters:
key
- The key against which to check for a given value within the current thread.- Returns:
- True if there is currently a session bound.
-
bind
Binds the given value to the current context for its key.- Type Parameters:
T
- Bind type.- Parameters:
key
- The key to be bound.value
- The value to be bound.- Returns:
- Any previously bound session (should be null in most cases).
-
unbind
Unbinds the session (if one) current associated with the context for the given session.- Type Parameters:
T
- Bind type.- Parameters:
key
- The factory for which to unbind the current session.- Returns:
- The bound session if one, else null.
-
get
Get a previously bind value for the given key ornull
.- Type Parameters:
T
- Object type.- Parameters:
key
- Key.- Returns:
- Binded value or
null
.
-
threadLocal
Exposes thread local state. Internal usage only (don't use it).- Returns:
- Exposes thread local state. Internal usage only (don't use it).
-