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 helperRequestContextthat itself ensures that there is always aRequestContextopened.booleanisActive()
-
Method Details
-
isActive
boolean isActive()- Returns:
- true, if a
RequestContextis currently active
-
getCurrent
Gives access to either the currentRequestContext, or if this does not exist to a helperRequestContextthat itself ensures that there is always aRequestContextopened. This method will throw aNullPointerException, if the passedCdsRuntimewas null, but guarantees that it will never returnnull- Parameters:
runtime- A reference to the underlyingCdsRuntimeinstance.- Returns:
- the current
RequestContextor a helperRequestContext
-