T
- the type of the handler function to filterR
- the type of the response of the function@FunctionalInterface public interface HandlerFilterFunction<T extends ServerResponse,R extends ServerResponse>
RouterFunction.filter(HandlerFilterFunction)
Modifier and Type | Method and Description |
---|---|
default HandlerFilterFunction<T,R> |
andThen(HandlerFilterFunction<T,T> after)
Return a composed filter function that first applies this filter, and then applies the
after filter. |
default HandlerFunction<R> |
apply(HandlerFunction<T> handler)
Apply this filter to the given handler function, resulting in a filtered handler function.
|
R |
filter(ServerRequest request,
HandlerFunction<T> next)
Apply this filter to the given handler function.
|
static <T extends ServerResponse> |
ofErrorHandler(Predicate<Throwable> predicate,
BiFunction<Throwable,ServerRequest,T> errorHandler)
Adapt the given predicate and response provider function to a filter function that returns
a
ServerResponse on a given exception. |
static <T extends ServerResponse> |
ofRequestProcessor(Function<ServerRequest,ServerRequest> requestProcessor)
Adapt the given request processor function to a filter function that only operates
on the
ServerRequest . |
static <T extends ServerResponse,R extends ServerResponse> |
ofResponseProcessor(BiFunction<ServerRequest,T,R> responseProcessor)
Adapt the given response processor function to a filter function that only operates
on the
ServerResponse . |
R filter(ServerRequest request, HandlerFunction<T> next) throws Exception
request
- the requestnext
- the next handler or filter function in the chainException
default HandlerFilterFunction<T,R> andThen(HandlerFilterFunction<T,T> after)
after
filter.after
- the filter to apply after this filter is appliedafter
functiondefault HandlerFunction<R> apply(HandlerFunction<T> handler)
handler
- the handler function to filterstatic <T extends ServerResponse> HandlerFilterFunction<T,T> ofRequestProcessor(Function<ServerRequest,ServerRequest> requestProcessor)
ServerRequest
.requestProcessor
- the request processorstatic <T extends ServerResponse,R extends ServerResponse> HandlerFilterFunction<T,R> ofResponseProcessor(BiFunction<ServerRequest,T,R> responseProcessor)
ServerResponse
.responseProcessor
- the response processorstatic <T extends ServerResponse> HandlerFilterFunction<T,T> ofErrorHandler(Predicate<Throwable> predicate, BiFunction<Throwable,ServerRequest,T> errorHandler)
ServerResponse
on a given exception.predicate
- the predicate to match an exceptionerrorHandler
- the response provider