public class ThreadLocalRequestContextFacade extends AbstractRequestContextFacade
RequestContextFacade
that internally uses InheritableThreadLocal
to provide access
to the respective RequestContext
.
Important: This implementation should only be used when relying on container-managed threads only. In case you use a framework that manages threads (such as Hystrix), you have to rely on an implementation that is adjusted to your framework.
Constructor and Description |
---|
ThreadLocalRequestContextFacade() |
Modifier and Type | Method and Description |
---|---|
Optional<RequestContext> |
getCurrentRequestContext()
Returns the current
RequestContext , if present. |
void |
removeCurrentContext()
Removes the current
RequestContext . |
void |
setCurrentContext(RequestContext requestContext)
Sets the current
RequestContext . |
getCurrentRequest
@Nonnull public Optional<RequestContext> getCurrentRequestContext()
RequestContext
, if present.Optional
of the current RequestContext
.public void setCurrentContext(RequestContext requestContext)
RequestContext
.public void removeCurrentContext()
RequestContext
.Copyright © 2018 SAP SE. All rights reserved.