Merge branch '5.3.x'
This commit is contained in:
@@ -32,7 +32,7 @@ import reactor.core.publisher.Mono;
|
||||
*
|
||||
* Mono<String> bodyMono = exchangeFunction
|
||||
* .exchange(request)
|
||||
* .flatMap(response -> response.bodyToMono(String.class));
|
||||
* .flatMap(response -> response.bodyToMono(String.class));
|
||||
* </pre>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
|
||||
@@ -522,7 +522,7 @@ public interface WebClient {
|
||||
* Mono<Object> entityMono = client.get()
|
||||
* .uri("/persons/1")
|
||||
* .accept(MediaType.APPLICATION_JSON)
|
||||
* .exchangeToMono(response -> {
|
||||
* .exchangeToMono(response -> {
|
||||
* if (response.statusCode().equals(HttpStatus.OK)) {
|
||||
* return response.bodyToMono(Person.class);
|
||||
* }
|
||||
@@ -554,7 +554,7 @@ public interface WebClient {
|
||||
* Mono<Object> entityMono = client.get()
|
||||
* .uri("/persons")
|
||||
* .accept(MediaType.APPLICATION_JSON)
|
||||
* .exchangeToFlux(response -> {
|
||||
* .exchangeToFlux(response -> {
|
||||
* if (response.statusCode().equals(HttpStatus.OK)) {
|
||||
* return response.bodyToFlux(Person.class);
|
||||
* }
|
||||
@@ -751,7 +751,7 @@ public interface WebClient {
|
||||
* Provide a function to map specific error status codes to an error
|
||||
* signal to be propagated downstream instead of the response.
|
||||
* <p>By default, if there are no matching status handlers, responses
|
||||
* with status codes >= 400 are mapped to
|
||||
* with status codes >= 400 are mapped to
|
||||
* {@link WebClientResponseException} which is created with
|
||||
* {@link ClientResponse#createException()}.
|
||||
* <p>To suppress the treatment of a status code as an error and process
|
||||
@@ -766,7 +766,7 @@ public interface WebClient {
|
||||
* .retrieve()
|
||||
* .bodyToMono(Account.class)
|
||||
* .onErrorResume(WebClientResponseException.class,
|
||||
* ex -> ex.getRawStatusCode() == 404 ? Mono.empty() : Mono.error(ex));
|
||||
* ex -> ex.getRawStatusCode() == 404 ? Mono.empty() : Mono.error(ex));
|
||||
* </pre>
|
||||
* @param statusPredicate to match responses with
|
||||
* @param exceptionFunction to map the response to an error signal
|
||||
|
||||
@@ -670,7 +670,7 @@ public abstract class RouterFunctions {
|
||||
* <pre class="code">
|
||||
* RouterFunction<ServerResponse> nestedRoute =
|
||||
* RouterFunctions.route()
|
||||
* .nest(RequestPredicates.path("/user"), () ->
|
||||
* .nest(RequestPredicates.path("/user"), () ->
|
||||
* RouterFunctions.route()
|
||||
* .GET(this::listUsers)
|
||||
* .POST(this::createUser)
|
||||
@@ -695,7 +695,7 @@ public abstract class RouterFunctions {
|
||||
* <pre class="code">
|
||||
* RouterFunction<ServerResponse> nestedRoute =
|
||||
* RouterFunctions.route()
|
||||
* .nest(RequestPredicates.path("/user"), builder ->
|
||||
* .nest(RequestPredicates.path("/user"), builder ->
|
||||
* builder.GET(this::listUsers)
|
||||
* .POST(this::createUser))
|
||||
* .build();
|
||||
@@ -740,7 +740,7 @@ public abstract class RouterFunctions {
|
||||
* <pre class="code">
|
||||
* RouterFunction<ServerResponse> nestedRoute =
|
||||
* RouterFunctions.route()
|
||||
* .path("/user", builder ->
|
||||
* .path("/user", builder ->
|
||||
* builder.GET(this::listUsers)
|
||||
* .POST(this::createUser))
|
||||
* .build();
|
||||
@@ -762,7 +762,7 @@ public abstract class RouterFunctions {
|
||||
* RouterFunction<ServerResponse> filteredRoute =
|
||||
* RouterFunctions.route()
|
||||
* .GET("/user", this::listUsers)
|
||||
* .filter((request, next) -> {
|
||||
* .filter((request, next) -> {
|
||||
* // check for authentication headers
|
||||
* if (isAuthenticated(request)) {
|
||||
* return next.handle(request);
|
||||
@@ -788,7 +788,7 @@ public abstract class RouterFunctions {
|
||||
* RouterFunction<ServerResponse> filteredRoute =
|
||||
* RouterFunctions.route()
|
||||
* .GET("/user", this::listUsers)
|
||||
* .before(request -> {
|
||||
* .before(request -> {
|
||||
* log(request);
|
||||
* return request;
|
||||
* })
|
||||
@@ -809,7 +809,7 @@ public abstract class RouterFunctions {
|
||||
* RouterFunction<ServerResponse> filteredRoute =
|
||||
* RouterFunctions.route()
|
||||
* .GET("/user", this::listUsers)
|
||||
* .after((request, response) -> {
|
||||
* .after((request, response) -> {
|
||||
* log(response);
|
||||
* return response;
|
||||
* })
|
||||
@@ -829,8 +829,8 @@ public abstract class RouterFunctions {
|
||||
* RouterFunction<ServerResponse> filteredRoute =
|
||||
* RouterFunctions.route()
|
||||
* .GET("/user", this::listUsers)
|
||||
* .onError(e -> e instanceof IllegalStateException,
|
||||
* (e, request) -> ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR).build())
|
||||
* .onError(e -> e instanceof IllegalStateException,
|
||||
* (e, request) -> ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR).build())
|
||||
* .build();
|
||||
* </pre>
|
||||
* @param predicate the type of exception to filter
|
||||
@@ -850,7 +850,7 @@ public abstract class RouterFunctions {
|
||||
* RouterFunctions.route()
|
||||
* .GET("/user", this::listUsers)
|
||||
* .onError(IllegalStateException.class,
|
||||
* (e, request) -> ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR).build())
|
||||
* (e, request) -> ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR).build())
|
||||
* .build();
|
||||
* </pre>
|
||||
* @param exceptionType the type of exception to filter
|
||||
|
||||
@@ -310,7 +310,7 @@ public interface ServerRequest {
|
||||
* public Mono<ServerResponse> myHandleMethod(ServerRequest request) {
|
||||
* Instant lastModified = // application-specific calculation
|
||||
* return request.checkNotModified(lastModified)
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* // further request processing, actually building content
|
||||
* return ServerResponse.ok().body(...);
|
||||
* }));
|
||||
@@ -344,7 +344,7 @@ public interface ServerRequest {
|
||||
* public Mono<ServerResponse> myHandleMethod(ServerRequest request) {
|
||||
* String eTag = // application-specific calculation
|
||||
* return request.checkNotModified(eTag)
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* // further request processing, actually building content
|
||||
* return ServerResponse.ok().body(...);
|
||||
* }));
|
||||
@@ -381,7 +381,7 @@ public interface ServerRequest {
|
||||
* Instant lastModified = // application-specific calculation
|
||||
* String eTag = // application-specific calculation
|
||||
* return request.checkNotModified(lastModified, eTag)
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* .switchIfEmpty(Mono.defer(() -> {
|
||||
* // further request processing, actually building content
|
||||
* return ServerResponse.ok().body(...);
|
||||
* }));
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.util.PatternMatchUtils;
|
||||
* specified prefix and/or suffix. Exporting an attribute that holds the
|
||||
* RequestContext to all views is explicitly supported.
|
||||
*
|
||||
* <p>Example: prefix="templates/", suffix=".ftl", viewname="test" ->
|
||||
* <p>Example: prefix="templates/", suffix=".ftl", viewname="test" →
|
||||
* "templates/test.ftl"
|
||||
*
|
||||
* <p>As a special feature, redirect URLs can be specified via the "redirect:"
|
||||
|
||||
@@ -45,13 +45,13 @@ import reactor.core.publisher.Mono;
|
||||
* public Mono<Void> handle(WebSocketSession session) {
|
||||
*
|
||||
* Flux<WebSocketMessage> output = session.receive()
|
||||
* .doOnNext(message -> {
|
||||
* .doOnNext(message -> {
|
||||
* // ...
|
||||
* })
|
||||
* .concatMap(message -> {
|
||||
* .concatMap(message -> {
|
||||
* // ...
|
||||
* })
|
||||
* .map(value -> session.textMessage("Echo " + value));
|
||||
* .map(value -> session.textMessage("Echo " + value));
|
||||
*
|
||||
* return session.send(output);
|
||||
* }
|
||||
@@ -68,10 +68,10 @@ import reactor.core.publisher.Mono;
|
||||
* public Mono<Void> handle(WebSocketSession session) {
|
||||
*
|
||||
* Mono<Void> input = session.receive()
|
||||
* .doOnNext(message -> {
|
||||
* .doOnNext(message -> {
|
||||
* // ...
|
||||
* })
|
||||
* .concatMap(message -> {
|
||||
* .concatMap(message -> {
|
||||
* // ...
|
||||
* })
|
||||
* .then();
|
||||
|
||||
Reference in New Issue
Block a user