java.lang.Object
io.avaje.http.api.context.ThreadLocalRequestContextResolver
- All Implemented Interfaces:
RequestContextResolver
public final class ThreadLocalRequestContextResolver
extends Object
implements RequestContextResolver
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
callWith
(ServerContext request, Callable<T> callable) Wraps the execution of the given callable in request context processing.Retrieve the current server context.void
runWith
(ServerContext request, Runnable runnable) Wraps the execution of the given runnable in request context processing.<T> T
supplyWith
(ServerContext request, Supplier<T> supplier) Wraps the execution of the given supplier in request context processing.
-
Constructor Details
-
ThreadLocalRequestContextResolver
public ThreadLocalRequestContextResolver()
-
-
Method Details
-
callWith
Description copied from interface:RequestContextResolver
Wraps the execution of the given callable in request context processing.- Specified by:
callWith
in interfaceRequestContextResolver
- Type Parameters:
T
- The return type of the callable- Parameters:
request
- The request contextcallable
- The callable- Returns:
- The return value of the callable
- Throws:
Exception
- if the callable throws an exception
-
supplyWith
Description copied from interface:RequestContextResolver
Wraps the execution of the given supplier in request context processing.- Specified by:
supplyWith
in interfaceRequestContextResolver
- Type Parameters:
T
- The return type of the supplier- Parameters:
request
- The request contextsupplier
- The supplier- Returns:
- The return value of the supplier
-
runWith
Description copied from interface:RequestContextResolver
Wraps the execution of the given runnable in request context processing.- Specified by:
runWith
in interfaceRequestContextResolver
- Parameters:
request
- The request contextrunnable
- The runnable
-
currentRequest
Description copied from interface:RequestContextResolver
Retrieve the current server context.- Specified by:
currentRequest
in interfaceRequestContextResolver
- Returns:
- The request context if it is present
-