T
- the type of the handler function to route to@FunctionalInterface
public interface RouterFunction<T extends ServerResponse>
RouterFunctions
Modifier and Type | Method and Description |
---|---|
default void |
accept(RouterFunctions.Visitor visitor)
Accept the given visitor.
|
default RouterFunction<T> |
and(RouterFunction<T> other)
Return a composed routing function that first invokes this function,
and then invokes the
other function (of the same response type T )
if this route had no result. |
default RouterFunction<T> |
andNest(RequestPredicate predicate,
RouterFunction<T> routerFunction)
Return a composed routing function that routes to the given router function if this
route does not match and the given request predicate applies.
|
default RouterFunction<?> |
andOther(RouterFunction<?> other)
Return a composed routing function that first invokes this function,
and then invokes the
other function (of a different response type) if this route had
no result. |
default RouterFunction<T> |
andRoute(RequestPredicate predicate,
HandlerFunction<T> handlerFunction)
Return a composed routing function that routes to the given handler function if this
route does not match and the given request predicate applies.
|
default <S extends ServerResponse> |
filter(HandlerFilterFunction<T,S> filterFunction)
Filter all handler functions routed by this function with the given
filter function.
|
reactor.core.publisher.Mono<HandlerFunction<T>> |
route(ServerRequest request)
Return the handler function that matches the given request.
|
reactor.core.publisher.Mono<HandlerFunction<T>> route(ServerRequest request)
request
- the request to routeMono
describing the HandlerFunction
that matches this request,
or an empty Mono
if there is no matchdefault RouterFunction<T> and(RouterFunction<T> other)
other
function (of the same response type T
)
if this route had no result.other
- the function of type T
to apply when this function has no resultother
function if this function has no resultandOther(RouterFunction)
default RouterFunction<?> andOther(RouterFunction<?> other)
other
function (of a different response type) if this route had
no result.other
- the function to apply when this function has no resultother
function if this function has no resultand(RouterFunction)
default RouterFunction<T> andRoute(RequestPredicate predicate, HandlerFunction<T> handlerFunction)
and(RouterFunction)
and
RouterFunctions.route(RequestPredicate, HandlerFunction)
.predicate
- the predicate to test if this route does not matchhandlerFunction
- the handler function to route to if this route does not match and
the predicate applieshandlerFunction
if this route does not
match and if predicate
appliesdefault RouterFunction<T> andNest(RequestPredicate predicate, RouterFunction<T> routerFunction)
and(RouterFunction)
and
RouterFunctions.nest(RequestPredicate, RouterFunction)
.predicate
- the predicate to test if this route does not matchrouterFunction
- the router function to route to if this route does not match and
the predicate appliesrouterFunction
if this route does not
match and if predicate
appliesdefault <S extends ServerResponse> RouterFunction<S> filter(HandlerFilterFunction<T,S> filterFunction)
S
- the filter return typefilterFunction
- the filter to applydefault void accept(RouterFunctions.Visitor visitor)
RouterFunctions.Visitor.unknown(RouterFunction)
; composed RouterFunction
implementations are expected to call accept
for all components that make up this
router functionvisitor
- the visitor to accept