-
- All Known Implementing Classes:
CacheInterceptor,RedirectingInterceptor,RetryInterceptor
- Enclosing class:
- Methanol
public static interface Methanol.InterceptorAn object that intercepts requests before being sent and responses before being returned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMethanol.Interceptor.Chain<T>An object that gives interceptors the ability to relay requests to sibling interceptors, till eventually being sent by the client's backend.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Methanol.Interceptorcreate(java.util.function.Function<java.net.http.HttpRequest,java.net.http.HttpRequest> operator)Returns an interceptor that forwards the request after applying the given operator.<T> java.net.http.HttpResponse<T>intercept(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain)Intercepts given request and returns the resulting response, usually by forwarding to the given chain.<T> java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<T>>interceptAsync(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain)Intercepts the given request and returns aCompletableFuturefor the resulting response, usually by forwarding to the given chain.
-
-
-
Method Detail
-
intercept
<T> java.net.http.HttpResponse<T> intercept(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain) throws java.io.IOException, java.lang.InterruptedExceptionIntercepts given request and returns the resulting response, usually by forwarding to the given chain.- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
interceptAsync
<T> java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<T>> interceptAsync(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain)Intercepts the given request and returns aCompletableFuturefor the resulting response, usually by forwarding to the given chain.
-
create
static Methanol.Interceptor create(java.util.function.Function<java.net.http.HttpRequest,java.net.http.HttpRequest> operator)
Returns an interceptor that forwards the request after applying the given operator.
-
-