Package com.linecorp.armeria.common
Class RequestContextStorageWrapper
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<RequestContextStorage>
com.linecorp.armeria.common.RequestContextStorageWrapper
- All Implemented Interfaces:
RequestContextStorage
,Unwrappable
public class RequestContextStorageWrapper
extends AbstractUnwrappable<RequestContextStorage>
implements RequestContextStorage
Wraps an existing
RequestContextStorage
.- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a new instance that wraps the specifiedRequestContextStorage
. -
Method Summary
Modifier and TypeMethodDescription<T extends RequestContext>
TReturns theRequestContext
in the storage.void
pop
(RequestContext current, @Nullable RequestContext toRestore) Pops the currentRequestContext
in the storage and pushes back the specifiedtoRestore
.<T extends RequestContext>
Tpush
(RequestContext toPush) Pushes the specifiedRequestContext
into the storage.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap, unwrapAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.common.RequestContextStorage
unwrap
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
as, equalsIgnoreWrapper, unwrapAll
-
Constructor Details
-
RequestContextStorageWrapper
Creates a new instance that wraps the specifiedRequestContextStorage
.
-
-
Method Details
-
push
Description copied from interface:RequestContextStorage
Pushes the specifiedRequestContext
into the storage.- Specified by:
push
in interfaceRequestContextStorage
- Returns:
- the old
RequestContext
which was in the storage before the specifiedtoPush
is pushed.null
, if there was noRequestContext
.
-
pop
Description copied from interface:RequestContextStorage
Pops the currentRequestContext
in the storage and pushes back the specifiedtoRestore
.toRestore
is theRequestContext
returned from when push(current) is called, so it can benull
.The specified
current
must be theRequestContext
in the storage. If it's not, it means thatRequestContext.push()
is not called usingtry-with-resources
block, so the previousRequestContext
is not popped properly.- Specified by:
pop
in interfaceRequestContextStorage
-
currentOrNull
Description copied from interface:RequestContextStorage
- Specified by:
currentOrNull
in interfaceRequestContextStorage
-