- Type Parameters:
T
- the response body type
- Enclosing interface:
Methanol.Interceptor
public static interface Methanol.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
Modifier and TypeMethodDescriptionReturns theBodyHandler
this chain uses for handling the response.forward
(HttpRequest request) Forwards the request to the next interceptor, or to the client's backend if called by the last interceptor.forwardAsync
(HttpRequest request) Forwards the request to the next interceptor, or asynchronously to the client's backend if called by the last interceptor.Returns thePushPromiseHandler
this chain uses for handling push promises.default <U> Methanol.Interceptor.Chain
<U> with
(HttpResponse.BodyHandler<U> bodyHandler, @Nullable HttpResponse.PushPromiseHandler<U> pushPromiseHandler) Returns a new chain that uses given handlers, possibly targeting another response type.default Methanol.Interceptor.Chain
<T> with
(UnaryOperator<HttpResponse.BodyHandler<T>> bodyHandlerTransformer) Returns a new chain after applying the given function to this chain's body handler.default Methanol.Interceptor.Chain
<T> with
(UnaryOperator<HttpResponse.BodyHandler<T>> bodyHandlerTransformer, UnaryOperator<HttpResponse.PushPromiseHandler<T>> pushPromiseHandlerTransformer) Returns a new chain after applying the given functions to this chain's body and push promise handlers, and only to the latter if a push promise handler is present.withBodyHandler
(HttpResponse.BodyHandler<T> bodyHandler) Returns a new chain that uses the givenBodyHandler
.withPushPromiseHandler
(@Nullable HttpResponse.PushPromiseHandler<T> pushPromiseHandler) Returns a new chain that uses the givenPushPromiseHandler
.
-
Method Details
-
bodyHandler
HttpResponse.BodyHandler<T> bodyHandler()Returns theBodyHandler
this chain uses for handling the response. -
pushPromiseHandler
Optional<HttpResponse.PushPromiseHandler<T>> pushPromiseHandler()Returns thePushPromiseHandler
this chain uses for handling push promises. -
withBodyHandler
Returns a new chain that uses the givenBodyHandler
. -
withPushPromiseHandler
Methanol.Interceptor.Chain<T> withPushPromiseHandler(@Nullable HttpResponse.PushPromiseHandler<T> pushPromiseHandler) Returns a new chain that uses the givenPushPromiseHandler
. -
with
default <U> Methanol.Interceptor.Chain<U> with(HttpResponse.BodyHandler<U> bodyHandler, @Nullable HttpResponse.PushPromiseHandler<U> pushPromiseHandler) Returns a new chain that uses given handlers, possibly targeting another response type. -
with
default Methanol.Interceptor.Chain<T> with(UnaryOperator<HttpResponse.BodyHandler<T>> bodyHandlerTransformer) Returns a new chain after applying the given function to this chain's body handler. -
with
default Methanol.Interceptor.Chain<T> with(UnaryOperator<HttpResponse.BodyHandler<T>> bodyHandlerTransformer, UnaryOperator<HttpResponse.PushPromiseHandler<T>> pushPromiseHandlerTransformer) Returns a new chain after applying the given functions to this chain's body and push promise handlers, and only to the latter if a push promise handler is present. -
forward
Forwards the request to the next interceptor, or to the client's backend if called by the last interceptor.- Throws:
IOException
InterruptedException
-
forwardAsync
Forwards the request to the next interceptor, or asynchronously to the client's backend if called by the last interceptor.
-