Class PlainRequestContextHolder
java.lang.Object
com.sap.cds.framework.plain.servlet.PlainRequestContextHolder
- All Implemented Interfaces:
AutoCloseable
A thread-local storage to keep request-dependent data.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static <K,
V> V get
(K key) Fetches the value stored for given key.static PlainRequestContextHolder
Creates a new context instance.<K,
V> void set
(K key, V value) Stores the given value for the given key in the current request context.
-
Method Details
-
initialize
Creates a new context instance.- Returns:
- The context holder instance for the current thread
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
get
public static <K,V> V get(K key) Fetches the value stored for given key.- Type Parameters:
K
- The key typeV
- The value type- Parameters:
key
- The key- Returns:
- The value of
null
if not existing
-
set
public <K,V> void set(K key, V value) Stores the given value for the given key in the current request context.- Type Parameters:
K
- The key typeV
- The value type- Parameters:
key
- The keyvalue
- The value
-