public static interface WebClient.ResponseSpec
Modifier and Type | Method and Description |
---|---|
<T> reactor.core.publisher.Flux<T> |
bodyToFlux(java.lang.Class<T> elementType)
Extract the body to a
Flux . |
<T> reactor.core.publisher.Flux<T> |
bodyToFlux(ParameterizedTypeReference<T> typeReference)
Extract the body to a
Flux . |
<T> reactor.core.publisher.Mono<T> |
bodyToMono(java.lang.Class<T> bodyType)
Extract the body to a
Mono . |
<T> reactor.core.publisher.Mono<T> |
bodyToMono(ParameterizedTypeReference<T> typeReference)
Extract the body to a
Mono . |
WebClient.ResponseSpec |
onStatus(java.util.function.Predicate<HttpStatus> statusPredicate,
java.util.function.Function<ClientResponse,reactor.core.publisher.Mono<? extends java.lang.Throwable>> exceptionFunction)
Register a custom error function that gets invoked when the given
HttpStatus
predicate applies. |
WebClient.ResponseSpec onStatus(java.util.function.Predicate<HttpStatus> statusPredicate, java.util.function.Function<ClientResponse,reactor.core.publisher.Mono<? extends java.lang.Throwable>> exceptionFunction)
HttpStatus
predicate applies. The exception returned from the function will be returned from
bodyToMono(Class)
and bodyToFlux(Class)
.
By default, an error handler is register that throws a
WebClientResponseException
when the response status code is 4xx or 5xx.
statusPredicate
- a predicate that indicates whether exceptionFunction
appliesexceptionFunction
- the function that returns the exception<T> reactor.core.publisher.Mono<T> bodyToMono(java.lang.Class<T> bodyType)
Mono
. By default, if the response has status code 4xx or
5xx, the Mono
will contain a WebClientException
. This can be overridden
with onStatus(Predicate, Function)
.T
- response body typebodyType
- the expected response body typeWebClientResponseException
if the
status code is 4xx or 5xx<T> reactor.core.publisher.Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference)
Mono
. By default, if the response has status code 4xx or
5xx, the Mono
will contain a WebClientException
. This can be overridden
with onStatus(Predicate, Function)
.T
- response body typetypeReference
- a type reference describing the expected response body typeWebClientResponseException
if the
status code is 4xx or 5xx<T> reactor.core.publisher.Flux<T> bodyToFlux(java.lang.Class<T> elementType)
Flux
. By default, if the response has status code 4xx or
5xx, the Flux
will contain a WebClientException
. This can be overridden
with onStatus(Predicate, Function)
.T
- the type of elements in the responseelementType
- the type of element in the responseWebClientResponseException
if the
status code is 4xx or 5xx<T> reactor.core.publisher.Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference)
Flux
. By default, if the response has status code 4xx or
5xx, the Flux
will contain a WebClientException
. This can be overridden
with onStatus(Predicate, Function)
.T
- the type of elements in the responsetypeReference
- a type reference describing the expected response body typeWebClientResponseException
if the
status code is 4xx or 5xx