public final class ServerRequestContext
extends java.lang.Object
HttpRequest that is bound to instrumented threads.
 Allowing lookup of the current request if it is present.| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
KEY  | 
| Modifier and Type | Method and Description | 
|---|---|
static <T> java.util.Optional<HttpRequest<T>> | 
currentRequest()
Retrieve the current server request context. 
 | 
static java.lang.Runnable | 
instrument(HttpRequest request,
          java.lang.Runnable runnable)
Return a new runnable by instrumenting the given runnable with request context handling. 
 | 
static void | 
set(HttpRequest request)
Set  
HttpRequest. | 
static <T> T | 
with(HttpRequest request,
    java.util.concurrent.Callable<T> callable)
Wrap the execution of the given callable in request context processing. 
 | 
static void | 
with(HttpRequest request,
    java.lang.Runnable runnable)
Wrap the execution of the given runnable in request context processing. 
 | 
static <T> T | 
with(HttpRequest request,
    java.util.function.Supplier<T> callable)
Wrap the execution of the given callable in request context processing. 
 | 
public static final java.lang.String KEY
public static void set(@Nullable HttpRequest request)
HttpRequest.request - new HttpRequestpublic static void with(@Nullable HttpRequest request, @NonNull java.lang.Runnable runnable)
request - The requestrunnable - The runnablepublic static java.lang.Runnable instrument(@Nullable HttpRequest request, @NonNull java.lang.Runnable runnable)
request - The requestrunnable - The runnablepublic static <T> T with(@Nullable HttpRequest request, @NonNull java.util.function.Supplier<T> callable)
T - The return type of the callablerequest - The requestcallable - The callablepublic static <T> T with(@Nullable HttpRequest request, @NonNull java.util.concurrent.Callable<T> callable) throws java.lang.Exception
T - The return type of the callablerequest - The requestcallable - The callablejava.lang.Exception - If the callable throws an exceptionpublic static <T> java.util.Optional<HttpRequest<T>> currentRequest()
T - The body type