Add route(RequestPredicate, HandlerFunction) to RouterFunctions builder
Closes gh-22701
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -140,6 +140,12 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
||||
return add(RequestPredicates.OPTIONS(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder route(RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
return add(RouterFunctions.route(predicate, handlerFunction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder resources(String pattern, Resource location) {
|
||||
return add(RouterFunctions.resources(pattern, location));
|
||||
|
||||
@@ -477,6 +477,18 @@ public abstract class RouterFunctions {
|
||||
*/
|
||||
Builder OPTIONS(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all requests that match the
|
||||
* given predicate.
|
||||
*
|
||||
* @param predicate the request predicate to match
|
||||
* @param handlerFunction the handler function to handle all requests that match the predicate
|
||||
* @return this builder
|
||||
* @since 5.2
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder route(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds the given route to this builder. Can be used to merge externally defined router
|
||||
* functions into this builder, or can be combined with
|
||||
|
||||
Reference in New Issue
Block a user