Package com.sap.cds.services.request
Interface RequestContextAccessor
public interface RequestContextAccessor
Interface to access
RequestContext
objects. It's preferred to use it via RequestContext.getCurrent(CdsRuntime)
.
The implementation of the factory is loaded via ExtendedServiceLoader
and is therefore pluggable.-
Method Summary
Modifier and TypeMethodDescriptiongetCurrent
(CdsRuntime runtime) Gives access to either the currentRequestContext
, or if this does not exist to a helperRequestContext
that itself ensures that there is always aRequestContext
opened.boolean
isActive()
-
Method Details
-
isActive
boolean isActive()- Returns:
- true, if a
RequestContext
is currently active
-
getCurrent
Gives access to either the currentRequestContext
, or if this does not exist to a helperRequestContext
that itself ensures that there is always aRequestContext
opened. This method will throw aNullPointerException
, if the passedCdsRuntime
was null, but guarantees that it will never returnnull
- Parameters:
runtime
- A reference to the underlyingCdsRuntime
instance.- Returns:
- the current
RequestContext
or a helperRequestContext
-