public class ClientResponseWrapper extends Object implements ClientResponse
ClientResponse interface that can be subclassed
to adapt the request in a
exchange filter function.
All methods default to calling through to the wrapped request.| Modifier and Type | Class and Description |
|---|---|
static class |
ClientResponseWrapper.HeadersWrapper
Implementation of the
Headers interface that can be subclassed
to adapt the headers in a
exchange filter function. |
ClientResponse.Builder, ClientResponse.Headers| Constructor and Description |
|---|
ClientResponseWrapper(ClientResponse delegate)
Create a new
ClientResponseWrapper that wraps the given 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(Class<? extends T> elementClass)
Extract the body to a
Flux. |
<T> reactor.core.publisher.Flux<T> |
bodyToFlux(ParameterizedTypeReference<T> elementTypeRef)
Extract the body to a
Flux. |
<T> reactor.core.publisher.Mono<T> |
bodyToMono(Class<? extends T> elementClass)
Extract the body to a
Mono. |
<T> reactor.core.publisher.Mono<T> |
bodyToMono(ParameterizedTypeReference<T> elementTypeRef)
Extract the body to a
Mono. |
MultiValueMap<String,ResponseCookie> |
cookies()
Return the cookies of this response.
|
reactor.core.publisher.Mono<WebClientResponseException> |
createException()
Create a
WebClientResponseException that contains the response
status, headers, body, and the originating request. |
ClientResponse.Headers |
headers()
Return the headers of this response.
|
String |
logPrefix()
Return a log message prefix to use to correlate messages for this exchange.
|
int |
rawStatusCode()
Return the (potentially non-standard) status code of this response.
|
reactor.core.publisher.Mono<Void> |
releaseBody()
Release the body of this response.
|
ClientResponse |
response()
Return the wrapped request.
|
HttpStatus |
statusCode()
Return the HTTP status code as an
HttpStatus enum value. |
ExchangeStrategies |
strategies()
Return the strategies used to convert the body of this response.
|
reactor.core.publisher.Mono<ResponseEntity<Void>> |
toBodilessEntity()
Return this response as a delayed
ResponseEntity containing
status and headers, but no body. |
<T> reactor.core.publisher.Mono<ResponseEntity<T>> |
toEntity(Class<T> bodyType)
Return this response as a delayed
ResponseEntity. |
<T> reactor.core.publisher.Mono<ResponseEntity<T>> |
toEntity(ParameterizedTypeReference<T> bodyTypeReference)
Return this response as a delayed
ResponseEntity. |
<T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> |
toEntityList(Class<T> elementClass)
Return this response as a delayed list of
ResponseEntitys. |
<T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> |
toEntityList(ParameterizedTypeReference<T> elementTypeRef)
Return this response as a delayed list of
ResponseEntitys. |
public ClientResponseWrapper(ClientResponse delegate)
ClientResponseWrapper that wraps the given response.delegate - the response to wrappublic ClientResponse response()
public ExchangeStrategies strategies()
ClientResponsestrategies in interface ClientResponsepublic HttpStatus statusCode()
ClientResponseHttpStatus enum value.statusCode in interface ClientResponsenull)HttpStatus.valueOf(int)public int rawStatusCode()
ClientResponserawStatusCode in interface ClientResponseClientResponse.statusCode(),
HttpStatus.resolve(int)public ClientResponse.Headers headers()
ClientResponseheaders in interface ClientResponsepublic MultiValueMap<String,ResponseCookie> cookies()
ClientResponsecookies in interface ClientResponsepublic <T> T body(BodyExtractor<T,? super ClientHttpResponse> extractor)
ClientResponseBodyExtractor.body in interface ClientResponseT - the type of the body returnedextractor - the BodyExtractor that reads from the responsepublic <T> reactor.core.publisher.Mono<T> bodyToMono(Class<? extends T> elementClass)
ClientResponseMono.bodyToMono in interface ClientResponseT - the element typeelementClass - the class of element in the MonoTpublic <T> reactor.core.publisher.Mono<T> bodyToMono(ParameterizedTypeReference<T> elementTypeRef)
ClientResponseMono.bodyToMono in interface ClientResponseT - the element typeelementTypeRef - the type reference of element in the MonoTpublic <T> reactor.core.publisher.Flux<T> bodyToFlux(Class<? extends T> elementClass)
ClientResponseFlux.bodyToFlux in interface ClientResponseT - the element typeelementClass - the class of elements in the FluxTpublic <T> reactor.core.publisher.Flux<T> bodyToFlux(ParameterizedTypeReference<T> elementTypeRef)
ClientResponseFlux.bodyToFlux in interface ClientResponseT - the element typeelementTypeRef - the type reference of elements in the FluxTpublic reactor.core.publisher.Mono<Void> releaseBody()
ClientResponsereleaseBody in interface ClientResponseDataBufferUtils.release(DataBuffer)public reactor.core.publisher.Mono<ResponseEntity<Void>> toBodilessEntity()
ClientResponseResponseEntity containing
status and headers, but no body. Calling this method will
release the body of the response.toBodilessEntity in interface ClientResponseMono with the bodiless ResponseEntitypublic <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(Class<T> bodyType)
ClientResponseResponseEntity.toEntity in interface ClientResponseT - response body typebodyType - the expected response body typeMono with the ResponseEntitypublic <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> bodyTypeReference)
ClientResponseResponseEntity.toEntity in interface ClientResponseT - response body typebodyTypeReference - a type reference describing the expected response body typeMono with the ResponseEntitypublic <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList(Class<T> elementClass)
ClientResponseResponseEntitys.toEntityList in interface ClientResponseT - the type of elements in the listelementClass - the expected response body list element classMono with the list of ResponseEntityspublic <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList(ParameterizedTypeReference<T> elementTypeRef)
ClientResponseResponseEntitys.toEntityList in interface ClientResponseT - the type of elements in the listelementTypeRef - the expected response body list element reference typeMono with the list of ResponseEntityspublic reactor.core.publisher.Mono<WebClientResponseException> createException()
ClientResponseWebClientResponseException that contains the response
status, headers, body, and the originating request.createException in interface ClientResponseMono with the created exceptionpublic String logPrefix()
ClientResponseThe prefix is based on ClientRequest.logPrefix(), which
itself is based on the value of the LOG_ID_ATTRIBUTE request attribute, further surrounded with "[" and "]".
logPrefix in interface ClientResponseLOG_ID_ATTRIBUTE is not set