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> TcallWith(ServerContext request, Callable<T> callable) Wraps the execution of the given callable in request context processing.Retrieve the current server context.voidrunWith(ServerContext request, Runnable runnable) Wraps the execution of the given runnable in request context processing.<T> TsupplyWith(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:RequestContextResolverWraps the execution of the given callable in request context processing.- Specified by:
callWithin 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:RequestContextResolverWraps the execution of the given supplier in request context processing.- Specified by:
supplyWithin 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:RequestContextResolverWraps the execution of the given runnable in request context processing.- Specified by:
runWithin interfaceRequestContextResolver- Parameters:
request- The request contextrunnable- The runnable
-
currentRequest
Description copied from interface:RequestContextResolverRetrieve the current server context.- Specified by:
currentRequestin interfaceRequestContextResolver- Returns:
- The request context if it is present
-