- All Known Implementing Classes:
CacheInterceptor
,RedirectingInterceptor
- Enclosing class:
Methanol
public static interface Methanol.Interceptor
An object that intercepts requests being sent over a
Methanol
client.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An object that gives interceptors the ability to relay requests to sibling interceptors, till eventually being sent by the client's backend. -
Method Summary
Modifier and TypeMethodDescriptionstatic Methanol.Interceptor
create
(Function<HttpRequest, HttpRequest> operator) Returns an interceptor that forwards the request after applying the given operator.<T> HttpResponse
<T> intercept
(HttpRequest request, Methanol.Interceptor.Chain<T> chain) Intercepts given request and returns the resulting response, usually by forwarding to the given chain.<T> CompletableFuture
<HttpResponse<T>> interceptAsync
(HttpRequest request, Methanol.Interceptor.Chain<T> chain) Intercepts the given request and returns aCompletableFuture
for the resulting response, usually by forwarding to the given chain.
-
Method Details
-
intercept
<T> HttpResponse<T> intercept(HttpRequest request, Methanol.Interceptor.Chain<T> chain) throws IOException, InterruptedException Intercepts given request and returns the resulting response, usually by forwarding to the given chain.- Throws:
IOException
InterruptedException
-
interceptAsync
<T> CompletableFuture<HttpResponse<T>> interceptAsync(HttpRequest request, Methanol.Interceptor.Chain<T> chain) Intercepts the given request and returns aCompletableFuture
for the resulting response, usually by forwarding to the given chain. -
create
Returns an interceptor that forwards the request after applying the given operator.
-