Polishing
This commit is contained in:
parent
2e2d662158
commit
41bdde5d6b
|
|
@ -781,71 +781,86 @@ public interface WebClient {
|
||||||
Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction);
|
Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the body to a {@code Mono}. By default, if the response has status code 4xx or
|
* Decode the body to the given target type. For an error response (status
|
||||||
* 5xx, the {@code Mono} will contain a {@link WebClientException}. This can be overridden
|
* code of 4xx or 5xx), the {@code Mono} emits a {@link WebClientException}.
|
||||||
* with {@link #onStatus(Predicate, Function)}.
|
* Use {@link #onStatus(Predicate, Function)} to customize error response
|
||||||
* @param elementClass the expected response body element class
|
* handling.
|
||||||
* @param <T> response body type
|
* @param elementClass the type to decode to
|
||||||
* @return a mono containing the body, or a {@link WebClientResponseException} if the
|
* @param <T> the target body type
|
||||||
* status code is 4xx or 5xx
|
* @return the decoded body
|
||||||
*/
|
*/
|
||||||
<T> Mono<T> bodyToMono(Class<T> elementClass);
|
<T> Mono<T> bodyToMono(Class<T> elementClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the body to a {@code Mono}. By default, if the response has status code 4xx or
|
* Variant of {@link #bodyToMono(Class)} with a {@link ParameterizedTypeReference}.
|
||||||
* 5xx, the {@code Mono} will contain a {@link WebClientException}. This can be overridden
|
* @param elementTypeRef the type to decode to
|
||||||
* with {@link #onStatus(Predicate, Function)}.
|
* @param <T> the target body type
|
||||||
* @param elementTypeRef a type reference describing the expected response body element type
|
* @return the decoded body
|
||||||
* @param <T> response body type
|
|
||||||
* @return a mono containing the body, or a {@link WebClientResponseException} if the
|
|
||||||
* status code is 4xx or 5xx
|
|
||||||
*/
|
*/
|
||||||
<T> Mono<T> bodyToMono(ParameterizedTypeReference<T> elementTypeRef);
|
<T> Mono<T> bodyToMono(ParameterizedTypeReference<T> elementTypeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the body to a {@code Flux}. By default, if the response has status code 4xx or
|
* Decode the body to a {@link Flux} with elements of the given type.
|
||||||
* 5xx, the {@code Flux} will contain a {@link WebClientException}. This can be overridden
|
* For an error response (status code of 4xx or 5xx), the {@code Mono}
|
||||||
* with {@link #onStatus(Predicate, Function)}.
|
* emits a {@link WebClientException}. Use {@link #onStatus(Predicate, Function)}
|
||||||
* @param elementClass the class of elements in the response
|
* to customize error response handling.
|
||||||
* @param <T> the type of elements in the response
|
* @param elementClass the type of element to decode to
|
||||||
* @return a flux containing the body, or a {@link WebClientResponseException} if the
|
* @param <T> the body element type
|
||||||
* status code is 4xx or 5xx
|
* @return the decoded body
|
||||||
*/
|
*/
|
||||||
<T> Flux<T> bodyToFlux(Class<T> elementClass);
|
<T> Flux<T> bodyToFlux(Class<T> elementClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the body to a {@code Flux}. By default, if the response has status code 4xx or
|
* Variant of {@link #bodyToMono(Class)} with a {@link ParameterizedTypeReference}.
|
||||||
* 5xx, the {@code Flux} will contain a {@link WebClientException}. This can be overridden
|
* @param elementTypeRef the type of element to decode to
|
||||||
* with {@link #onStatus(Predicate, Function)}.
|
* @param <T> the body element type
|
||||||
* @param elementTypeRef a type reference describing the expected response body element type
|
* @return the decoded body
|
||||||
* @param <T> the type of elements in the response
|
|
||||||
* @return a flux containing the body, or a {@link WebClientResponseException} if the
|
|
||||||
* status code is 4xx or 5xx
|
|
||||||
*/
|
*/
|
||||||
<T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> elementTypeRef);
|
<T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> elementTypeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the response as a delayed {@code ResponseEntity}. By default, if the response has
|
* Return a {@code ResponseEntity} with the body decoded to an Object of
|
||||||
* status code 4xx or 5xx, the {@code Mono} will contain a {@link WebClientException}. This
|
* the given type. For an error response (status code of 4xx or 5xx), the
|
||||||
* can be overridden with {@link #onStatus(Predicate, Function)}.
|
* {@code Mono} emits a {@link WebClientException}. Use
|
||||||
|
* {@link #onStatus(Predicate, Function)} to customize error response handling.
|
||||||
* @param bodyClass the expected response body type
|
* @param bodyClass the expected response body type
|
||||||
* @param <T> response body type
|
* @param <T> response body type
|
||||||
* @return {@code Mono} with the {@code ResponseEntity}
|
* @return the {@code ResponseEntity} with the decoded body
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
<T> Mono<ResponseEntity<T>> toEntity(Class<T> bodyClass);
|
<T> Mono<ResponseEntity<T>> toEntity(Class<T> bodyClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the response as a delayed {@code ResponseEntity}. By default, if the response has
|
* Variant of {@link #bodyToMono(Class)} with a {@link ParameterizedTypeReference}.
|
||||||
* status code 4xx or 5xx, the {@code Mono} will contain a {@link WebClientException}. This
|
* @param bodyTypeReference the expected response body type
|
||||||
* can be overridden with {@link #onStatus(Predicate, Function)}.
|
* @param <T> the response body type
|
||||||
* @param bodyTypeReference a type reference describing the expected response body type
|
* @return the {@code ResponseEntity} with the decoded body
|
||||||
* @param <T> response body type
|
|
||||||
* @return {@code Mono} with the {@code ResponseEntity}
|
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
<T> Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> bodyTypeReference);
|
<T> Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> bodyTypeReference);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a {@code ResponseEntity} with the body decoded to a {@code List}
|
||||||
|
* of elements of the given type. For an error response (status code of
|
||||||
|
* 4xx or 5xx), the {@code Mono} emits a {@link WebClientException}.
|
||||||
|
* Use {@link #onStatus(Predicate, Function)} to customize error response
|
||||||
|
* handling.
|
||||||
|
* @param elementClass the type of element to decode the target Flux to
|
||||||
|
* @param <T> the body element type
|
||||||
|
* @return the {@code ResponseEntity}
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
<T> Mono<ResponseEntity<List<T>>> toEntityList(Class<T> elementClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
|
||||||
|
* @param elementTypeRef the type of element to decode the target Flux to
|
||||||
|
* @param <T> the body element type
|
||||||
|
* @return the {@code ResponseEntity}
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
<T> Mono<ResponseEntity<List<T>>> toEntityList(ParameterizedTypeReference<T> elementTypeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@code ResponseEntity} with the body decoded to a {@code Flux}
|
* Return a {@code ResponseEntity} with the body decoded to a {@code Flux}
|
||||||
* of elements of the given type. For an error response (status code of
|
* of elements of the given type. For an error response (status code of
|
||||||
|
|
@ -856,7 +871,7 @@ public interface WebClient {
|
||||||
* be subscribed to or else associated resources will not be released.
|
* be subscribed to or else associated resources will not be released.
|
||||||
* @param elementType the type of element to decode the target Flux to
|
* @param elementType the type of element to decode the target Flux to
|
||||||
* @param <T> the body element type
|
* @param <T> the body element type
|
||||||
* @return the resulting {@code ResponseEntity}
|
* @return the {@code ResponseEntity}
|
||||||
* @since 5.3.1
|
* @since 5.3.1
|
||||||
*/
|
*/
|
||||||
<T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(Class<T> elementType);
|
<T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(Class<T> elementType);
|
||||||
|
|
@ -865,43 +880,17 @@ public interface WebClient {
|
||||||
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
|
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
|
||||||
* @param elementTypeReference the type of element to decode the target Flux to
|
* @param elementTypeReference the type of element to decode the target Flux to
|
||||||
* @param <T> the body element type
|
* @param <T> the body element type
|
||||||
* @return the resulting {@code ResponseEntity}
|
* @return the {@code ResponseEntity}
|
||||||
* @since 5.3.1
|
* @since 5.3.1
|
||||||
*/
|
*/
|
||||||
<T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(ParameterizedTypeReference<T> elementTypeReference);
|
<T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(ParameterizedTypeReference<T> elementTypeReference);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the response as a delayed list of {@code ResponseEntity}s. By default, if the
|
* Return a {@code ResponseEntity} without a body. For an error response
|
||||||
* response has status code 4xx or 5xx, the {@code Mono} will contain a
|
* (status code of 4xx or 5xx), the {@code Mono} emits a
|
||||||
* {@link WebClientException}. This can be overridden with
|
* {@link WebClientException}. Use {@link #onStatus(Predicate, Function)}
|
||||||
* {@link #onStatus(Predicate, Function)}.
|
* to customize error response handling.
|
||||||
* @param elementClass the expected response body list element class
|
* @return the {@code ResponseEntity}
|
||||||
* @param <T> the type of elements in the list
|
|
||||||
* @return {@code Mono} with the list of {@code ResponseEntity}s
|
|
||||||
* @since 5.2
|
|
||||||
*/
|
|
||||||
<T> Mono<ResponseEntity<List<T>>> toEntityList(Class<T> elementClass);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the response as a delayed list of {@code ResponseEntity}s. By default, if the
|
|
||||||
* response has status code 4xx or 5xx, the {@code Mono} will contain a
|
|
||||||
* {@link WebClientException}. This can be overridden with
|
|
||||||
* {@link #onStatus(Predicate, Function)}.
|
|
||||||
* @param elementTypeRef the expected response body list element reference type
|
|
||||||
* @param <T> the type of elements in the list
|
|
||||||
* @return {@code Mono} with the list of {@code ResponseEntity}s
|
|
||||||
* @since 5.2
|
|
||||||
*/
|
|
||||||
<T> Mono<ResponseEntity<List<T>>> toEntityList(ParameterizedTypeReference<T> elementTypeRef);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the response as a delayed {@code ResponseEntity} containing status and headers,
|
|
||||||
* but no body. By default, if the response has status code 4xx or 5xx, the {@code Mono}
|
|
||||||
* will contain a {@link WebClientException}. This can be overridden with
|
|
||||||
* {@link #onStatus(Predicate, Function)}.
|
|
||||||
* Calling this method will {@linkplain ClientResponse#releaseBody() release} the body of
|
|
||||||
* the response.
|
|
||||||
* @return {@code Mono} with the bodiless {@code ResponseEntity}
|
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
Mono<ResponseEntity<Void>> toBodilessEntity();
|
Mono<ResponseEntity<Void>> toBodilessEntity();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue