Update generics on WebMvc RouterFunctions.Builder
Same as 7555d0e489, but for WebMvc.
Closes gh-35791
This commit is contained in:
parent
eadc5b09ac
commit
dff0858340
|
|
@ -38,6 +38,7 @@ import org.springframework.util.Assert;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Sebastien Deleuze
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.2
|
||||
*/
|
||||
class RouterFunctionBuilder implements RouterFunctions.Builder {
|
||||
|
|
@ -49,38 +50,38 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
private final List<HandlerFilterFunction<ServerResponse, ServerResponse>> errorHandlers = new ArrayList<>();
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RouterFunctions.Builder add(RouterFunction<ServerResponse> routerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder add(RouterFunction<T> routerFunction) {
|
||||
Assert.notNull(routerFunction, "RouterFunction must not be null");
|
||||
this.routerFunctions.add(routerFunction);
|
||||
this.routerFunctions.add((RouterFunction<ServerResponse>) routerFunction);
|
||||
return this;
|
||||
}
|
||||
|
||||
private RouterFunctions.Builder add(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
this.routerFunctions.add(RouterFunctions.route(predicate, handlerFunction));
|
||||
return this;
|
||||
private <T extends ServerResponse> RouterFunctions.Builder add(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RouterFunctions.route(predicate, handlerFunction));
|
||||
}
|
||||
|
||||
// GET
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder GET(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder GET(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.GET), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder GET(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder GET(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.GET).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder GET(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder GET(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.GET(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder GET(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder GET(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.GET(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -88,23 +89,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// HEAD
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder HEAD(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder HEAD(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.HEAD), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder HEAD(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder HEAD(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.HEAD).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder HEAD(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder HEAD(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.HEAD(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder HEAD(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder HEAD(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.HEAD(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -112,23 +113,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// POST
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder POST(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder POST(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.POST), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder POST(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder POST(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.POST).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder POST(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder POST(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.POST(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder POST(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder POST(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.POST(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -136,23 +137,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// PUT
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PUT(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PUT(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.PUT), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PUT(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PUT(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.PUT).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PUT(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PUT(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.PUT(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PUT(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PUT(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.PUT(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -160,23 +161,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// PATCH
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PATCH(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PATCH(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.PATCH), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PATCH(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PATCH(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.PATCH).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PATCH(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PATCH(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.PATCH(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder PATCH(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder PATCH(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.PATCH(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -184,23 +185,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// DELETE
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder DELETE(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder DELETE(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.DELETE), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder DELETE(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder DELETE(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.DELETE).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder DELETE(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder DELETE(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.DELETE(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder DELETE(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder DELETE(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.DELETE(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -208,23 +209,23 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// OPTIONS
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder OPTIONS(HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder OPTIONS(HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.OPTIONS), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder OPTIONS(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder OPTIONS(RequestPredicate predicate, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.method(HttpMethod.OPTIONS).and(predicate), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder OPTIONS(String pattern, HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder OPTIONS(String pattern, HandlerFunction<T> handlerFunction) {
|
||||
return add(RequestPredicates.OPTIONS(pattern), handlerFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder OPTIONS(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder OPTIONS(String pattern, RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
|
||||
return add(RequestPredicates.OPTIONS(pattern).and(predicate), handlerFunction);
|
||||
}
|
||||
|
|
@ -232,8 +233,8 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
// other
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder route(RequestPredicate predicate,
|
||||
HandlerFunction<ServerResponse> handlerFunction) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder route(RequestPredicate predicate,
|
||||
HandlerFunction<T> handlerFunction) {
|
||||
return add(RouterFunctions.route(predicate, handlerFunction));
|
||||
}
|
||||
|
||||
|
|
@ -285,13 +286,14 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RouterFunctions.Builder nest(RequestPredicate predicate,
|
||||
Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder nest(RequestPredicate predicate,
|
||||
Supplier<RouterFunction<T>> routerFunctionSupplier) {
|
||||
|
||||
Assert.notNull(routerFunctionSupplier, "RouterFunction Supplier must not be null");
|
||||
|
||||
RouterFunction<ServerResponse> nestedRoute = routerFunctionSupplier.get();
|
||||
RouterFunction<ServerResponse> nestedRoute = (RouterFunction<ServerResponse>) routerFunctionSupplier.get();
|
||||
this.routerFunctions.add(RouterFunctions.nest(predicate, nestedRoute));
|
||||
return this;
|
||||
}
|
||||
|
|
@ -304,17 +306,18 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder path(String pattern,
|
||||
Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder path(String pattern,
|
||||
Supplier<RouterFunction<T>> routerFunctionSupplier) {
|
||||
|
||||
return nest(RequestPredicates.path(pattern), routerFunctionSupplier);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RouterFunctions.Builder filter(HandlerFilterFunction<ServerResponse, ServerResponse> filterFunction) {
|
||||
public <T extends ServerResponse, R extends ServerResponse> RouterFunctions.Builder filter(HandlerFilterFunction<T, R> filterFunction) {
|
||||
Assert.notNull(filterFunction, "HandlerFilterFunction must not be null");
|
||||
|
||||
this.filterFunctions.add(filterFunction);
|
||||
this.filterFunctions.add((HandlerFilterFunction<ServerResponse, ServerResponse>) filterFunction);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -325,27 +328,29 @@ class RouterFunctionBuilder implements RouterFunctions.Builder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder after(
|
||||
BiFunction<ServerRequest, ServerResponse, ServerResponse> responseProcessor) {
|
||||
public <T extends ServerResponse, R extends ServerResponse> RouterFunctions.Builder after(
|
||||
BiFunction<ServerRequest, T, R> responseProcessor) {
|
||||
|
||||
Assert.notNull(responseProcessor, "ResponseProcessor must not be null");
|
||||
return filter(HandlerFilterFunction.ofResponseProcessor(responseProcessor));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RouterFunctions.Builder onError(Predicate<Throwable> predicate,
|
||||
BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder onError(Predicate<Throwable> predicate,
|
||||
BiFunction<Throwable, ServerRequest, T> responseProvider) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
Assert.notNull(responseProvider, "ResponseProvider must not be null");
|
||||
|
||||
this.errorHandlers.add(0, HandlerFilterFunction.ofErrorHandler(predicate, responseProvider));
|
||||
HandlerFilterFunction<T, T> filter = HandlerFilterFunction.ofErrorHandler(predicate, responseProvider);
|
||||
this.errorHandlers.add(0, (HandlerFilterFunction<ServerResponse, ServerResponse>) filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouterFunctions.Builder onError(Class<? extends Throwable> exceptionType,
|
||||
BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider) {
|
||||
public <T extends ServerResponse> RouterFunctions.Builder onError(Class<? extends Throwable> exceptionType,
|
||||
BiFunction<Throwable, ServerRequest, T> responseProvider) {
|
||||
Assert.notNull(exceptionType, "ExceptionType must not be null");
|
||||
Assert.notNull(responseProvider, "ResponseProvider must not be null");
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import org.springframework.web.util.pattern.PathPatternParser;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Sebastien Deleuze
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.2
|
||||
*/
|
||||
public abstract class RouterFunctions {
|
||||
|
|
@ -282,7 +283,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder GET(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder GET(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code GET} requests
|
||||
|
|
@ -293,7 +294,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder GET(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder GET(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code GET} requests
|
||||
|
|
@ -305,7 +306,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder GET(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder GET(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code GET} requests
|
||||
|
|
@ -326,7 +327,7 @@ public abstract class RouterFunctions {
|
|||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder GET(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder GET(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code HEAD} requests.
|
||||
|
|
@ -334,7 +335,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder HEAD(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder HEAD(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code HEAD} requests
|
||||
|
|
@ -345,7 +346,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder HEAD(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder HEAD(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code HEAD} requests
|
||||
|
|
@ -357,7 +358,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder HEAD(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder HEAD(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code HEAD} requests
|
||||
|
|
@ -369,7 +370,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder HEAD(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder HEAD(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code POST} requests.
|
||||
|
|
@ -377,7 +378,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder POST(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder POST(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code POST} requests
|
||||
|
|
@ -388,7 +389,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder POST(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder POST(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code POST} requests
|
||||
|
|
@ -400,7 +401,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder POST(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder POST(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code POST} requests
|
||||
|
|
@ -420,7 +421,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder POST(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder POST(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code PUT} requests.
|
||||
|
|
@ -428,7 +429,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder PUT(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PUT(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PUT} requests
|
||||
|
|
@ -439,7 +440,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder PUT(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PUT(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PUT} requests
|
||||
|
|
@ -451,7 +452,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder PUT(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PUT(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PUT} requests
|
||||
|
|
@ -471,7 +472,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder PUT(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PUT(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code PATCH} requests.
|
||||
|
|
@ -479,7 +480,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder PATCH(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PATCH(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PATCH} requests
|
||||
|
|
@ -490,7 +491,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder PATCH(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PATCH(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PATCH} requests
|
||||
|
|
@ -502,7 +503,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder PATCH(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PATCH(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code PATCH} requests
|
||||
|
|
@ -522,7 +523,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder PATCH(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder PATCH(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code DELETE} requests.
|
||||
|
|
@ -530,7 +531,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder DELETE(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder DELETE(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code DELETE} requests
|
||||
|
|
@ -541,7 +542,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder DELETE(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder DELETE(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code DELETE} requests
|
||||
|
|
@ -553,7 +554,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder DELETE(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder DELETE(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code DELETE} requests
|
||||
|
|
@ -565,7 +566,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder DELETE(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder DELETE(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles HTTP {@code OPTIONS} requests.
|
||||
|
|
@ -573,7 +574,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @since 5.3
|
||||
*/
|
||||
Builder OPTIONS(HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder OPTIONS(HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code OPTIONS} requests
|
||||
|
|
@ -584,7 +585,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder OPTIONS(String pattern, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder OPTIONS(String pattern, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code OPTIONS} requests
|
||||
|
|
@ -596,7 +597,7 @@ public abstract class RouterFunctions {
|
|||
* @since 5.3
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder OPTIONS(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder OPTIONS(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all HTTP {@code OPTIONS} requests
|
||||
|
|
@ -608,7 +609,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder OPTIONS(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder OPTIONS(String pattern, RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds a route to the given handler function that handles all requests that match the
|
||||
|
|
@ -618,7 +619,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder route(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
|
||||
<T extends ServerResponse> Builder route(RequestPredicate predicate, HandlerFunction<T> handlerFunction);
|
||||
|
||||
/**
|
||||
* Adds the given route to this builder. Can be used to merge externally defined router
|
||||
|
|
@ -639,7 +640,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder add(RouterFunction<ServerResponse> routerFunction);
|
||||
<T extends ServerResponse> Builder add(RouterFunction<T> routerFunction);
|
||||
|
||||
/**
|
||||
* Route requests that match the given predicate to the given resource.
|
||||
|
|
@ -743,7 +744,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see RequestPredicates
|
||||
*/
|
||||
Builder nest(RequestPredicate predicate, Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier);
|
||||
<T extends ServerResponse> Builder nest(RequestPredicate predicate, Supplier<RouterFunction<T>> routerFunctionSupplier);
|
||||
|
||||
/**
|
||||
* Route to a built router function if the given request predicate applies.
|
||||
|
|
@ -789,7 +790,7 @@ public abstract class RouterFunctions {
|
|||
* @return this builder
|
||||
* @see org.springframework.web.util.pattern.PathPattern
|
||||
*/
|
||||
Builder path(String pattern, Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier);
|
||||
<T extends ServerResponse> Builder path(String pattern, Supplier<RouterFunction<T>> routerFunctionSupplier);
|
||||
|
||||
/**
|
||||
* Route to a built router function if the given path prefix pattern applies.
|
||||
|
|
@ -838,7 +839,7 @@ public abstract class RouterFunctions {
|
|||
* @param filterFunction the function to filter all routes built by this builder
|
||||
* @return this builder
|
||||
*/
|
||||
Builder filter(HandlerFilterFunction<ServerResponse, ServerResponse> filterFunction);
|
||||
<T extends ServerResponse, R extends ServerResponse> Builder filter(HandlerFilterFunction<T, R> filterFunction);
|
||||
|
||||
/**
|
||||
* Filter the request object for all routes created by this builder with the given request
|
||||
|
|
@ -880,7 +881,7 @@ public abstract class RouterFunctions {
|
|||
* @param responseProcessor a function that transforms the response
|
||||
* @return this builder
|
||||
*/
|
||||
Builder after(BiFunction<ServerRequest, ServerResponse, ServerResponse> responseProcessor);
|
||||
<T extends ServerResponse, R extends ServerResponse> Builder after(BiFunction<ServerRequest, T, R> responseProcessor);
|
||||
|
||||
/**
|
||||
* Filters all exceptions that match the predicate by applying the given response provider
|
||||
|
|
@ -899,8 +900,8 @@ public abstract class RouterFunctions {
|
|||
* @param responseProvider a function that creates a response
|
||||
* @return this builder
|
||||
*/
|
||||
Builder onError(Predicate<Throwable> predicate,
|
||||
BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider);
|
||||
<T extends ServerResponse> Builder onError(Predicate<Throwable> predicate,
|
||||
BiFunction<Throwable, ServerRequest, T> responseProvider);
|
||||
|
||||
/**
|
||||
* Filters all exceptions of the given type by applying the given response provider
|
||||
|
|
@ -919,8 +920,8 @@ public abstract class RouterFunctions {
|
|||
* @param responseProvider a function that creates a response
|
||||
* @return this builder
|
||||
*/
|
||||
Builder onError(Class<? extends Throwable> exceptionType,
|
||||
BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider);
|
||||
<T extends ServerResponse> Builder onError(Class<? extends Throwable> exceptionType,
|
||||
BiFunction<Throwable, ServerRequest, T> responseProvider);
|
||||
|
||||
/**
|
||||
* Add an attribute with the given name and value to the last route built with this builder.
|
||||
|
|
|
|||
Loading…
Reference in New Issue