Interface ExchangeInterceptor<A extends ExchangeContext,B extends Exchange<A>>
- Type Parameters:
A
- the type of the exchange contextB
- the type of exchange handled by the handler
- All Known Subinterfaces:
SecurityInterceptor<A,
B, C, D, E>
- All Known Implementing Classes:
AccessControlInterceptor
,AuthenticationErrorInterceptor
,BasicAuthenticationErrorInterceptor
,ContinueInterceptor
,CORSInterceptor
,CSRFDoubleSubmitCookieInterceptor
,DigestAuthenticationErrorInterceptor
,FormAuthenticationErrorInterceptor
,HttpAccessLogsInterceptor
,HttpAuthenticationErrorInterceptor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An exchange interceptor is used to intercept a server exchange before it is handled by a ExchangeHandler
.
Multiple exchange interceptors can be chained on an exchange handler invoking ReactiveExchangeHandler.intercept(io.inverno.mod.http.server.ExchangeInterceptor)
method multiple times in
order to form an exchange handling chain.
An exchange interceptor is meant to perform extra processing or instrumentation on the exchange prior to the actual exchange processing by the exchange handler. But it can also fully process the exchange and stop the exchange handling chain by returning an empty Mono in which case the exchange handler will not be invoked.
- Since:
- 1.3
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ExchangeInterceptor
<A, B> andThen
(ExchangeInterceptor<? super A, B> after) Returns a composed interceptor that invokes this interceptor first and then invokes the specified interceptor.default ExchangeInterceptor
<A, B> compose
(ExchangeInterceptor<? super A, B> before) Returns a composed interceptor that invokes the specified interceptor first and then invokes this interceptor.Intercepts the exchange before the exchange handler is invoked.static <A extends ExchangeContext,
B extends Exchange<A>>
ExchangeInterceptor<A, B> of
(ExchangeInterceptor<? super A, B>... interceptors) Returns an interceptor resulting from chaining the specified interceptors in sequence.
-
Method Details
-
intercept
Intercepts the exchange before the exchange handler is invoked.
- Parameters:
exchange
- the server exchange to handle- Returns:
- a Mono emitting the exchange or an instrumented exchange to continue the exchange handling chain or an empty Mono to stop the exchange handling chain
-
andThen
Returns a composed interceptor that invokes this interceptor first and then invokes the specified interceptor.
- Parameters:
after
- the interceptor to invoke after this interceptor- Returns:
- a composed interceptor that invokes in sequence this interceptor followed by the specified interceptor
-
compose
Returns a composed interceptor that invokes the specified interceptor first and then invokes this interceptor.
- Parameters:
before
- the interceptor to invoke before this interceptor- Returns:
- a composed interceptor that invokes in sequence this interceptor followed by the specified interceptor
-
of
@SafeVarargs static <A extends ExchangeContext,B extends Exchange<A>> ExchangeInterceptor<A,B> of(ExchangeInterceptor<? super A, B>... interceptors) Returns an interceptor resulting from chaining the specified interceptors in sequence.
- Type Parameters:
A
- the type of the exchange contextB
- the type of exchange handled by the handler- Parameters:
interceptors
- the interceptors to chain- Returns:
- a composed interceptor
-