public interface ClientResponse
WebClient and also
ExchangeFunction. Provides access to the response status and headers,
and also methods to consume the response body.
NOTE: When given access to a ClientResponse you
must always use the response body or entity methods to ensure resources are
released and to avoid potential issues with HTTP connection pooling. If not
interested in the response body, use "bodyToMono(Void.class)".
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ClientResponse.Headers
Represents the headers of the HTTP response.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
body(BodyExtractor<T,? super ClientHttpResponse> extractor)
Extract the body with the given
BodyExtractor. |
<T> reactor.core.publisher.Flux<T> |
bodyToFlux(java.lang.Class<? extends T> elementClass)
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<? extends T> elementClass)
Extract the body to a
Mono. |
<T> reactor.core.publisher.Mono<T> |
bodyToMono(ParameterizedTypeReference<T> typeReference)
Extract the body to a
Mono. |
MultiValueMap<java.lang.String,ResponseCookie> |
cookies()
Return cookies of this response.
|
ClientResponse.Headers |
headers()
Return the headers of this response.
|
HttpStatus |
statusCode()
Return the status code of this response.
|
<T> reactor.core.publisher.Mono<ResponseEntity<T>> |
toEntity(java.lang.Class<T> bodyType)
Return this response as a delayed
ResponseEntity. |
<T> reactor.core.publisher.Mono<ResponseEntity<T>> |
toEntity(ParameterizedTypeReference<T> typeReference)
Return this response as a delayed
ResponseEntity. |
<T> reactor.core.publisher.Mono<ResponseEntity<java.util.List<T>>> |
toEntityList(java.lang.Class<T> elementType)
Return this response as a delayed list of
ResponseEntitys. |
<T> reactor.core.publisher.Mono<ResponseEntity<java.util.List<T>>> |
toEntityList(ParameterizedTypeReference<T> typeReference)
Return this response as a delayed list of
ResponseEntitys. |
HttpStatus statusCode()
ClientResponse.Headers headers()
MultiValueMap<java.lang.String,ResponseCookie> cookies()
<T> T body(BodyExtractor<T,? super ClientHttpResponse> extractor)
BodyExtractor.T - the type of the body returnedextractor - the BodyExtractor that reads from the response<T> reactor.core.publisher.Mono<T> bodyToMono(java.lang.Class<? extends T> elementClass)
Mono.T - the element typeelementClass - the class of element in the MonoT<T> reactor.core.publisher.Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference)
Mono.T - the element typetypeReference - a type reference describing the expected response body typeT<T> reactor.core.publisher.Flux<T> bodyToFlux(java.lang.Class<? extends T> elementClass)
Flux.T - the element typeelementClass - the class of element in the FluxT<T> reactor.core.publisher.Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference)
Flux.T - the element typetypeReference - a type reference describing the expected response body typeT<T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(java.lang.Class<T> bodyType)
ResponseEntity.T - response body typebodyType - the expected response body typeMono with the ResponseEntity<T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> typeReference)
ResponseEntity.T - response body typetypeReference - a type reference describing the expected response body typeMono with the ResponseEntity<T> reactor.core.publisher.Mono<ResponseEntity<java.util.List<T>>> toEntityList(java.lang.Class<T> elementType)
ResponseEntitys.T - the type of elements in the listelementType - the expected response body list element typeMono with the list of ResponseEntitys<T> reactor.core.publisher.Mono<ResponseEntity<java.util.List<T>>> toEntityList(ParameterizedTypeReference<T> typeReference)
ResponseEntitys.T - the type of elements in the listtypeReference - a type reference describing the expected response body typeMono with the list of ResponseEntitys