class DefaultClientResponse extends java.lang.Object implements ClientResponse
ClientResponse
.Modifier and Type | Class and Description |
---|---|
private class |
DefaultClientResponse.DefaultHeaders |
ClientResponse.Builder, ClientResponse.Headers
Modifier and Type | Field and Description |
---|---|
private ClientResponse.Headers |
headers |
private java.lang.String |
logPrefix |
private java.lang.String |
requestDescription |
private ClientHttpResponse |
response |
private ExchangeStrategies |
strategies |
Constructor and Description |
---|
DefaultClientResponse(ClientHttpResponse response,
ExchangeStrategies strategies,
java.lang.String logPrefix,
java.lang.String requestDescription) |
Modifier and Type | Method and Description |
---|---|
<T> T |
body(BodyExtractor<T,? super ClientHttpResponse> extractor)
Extract the body with the given
BodyExtractor . |
<T> <any> |
bodyToFlux(java.lang.Class<? extends T> elementClass)
Extract the body to a
Flux . |
<T> <any> |
bodyToFlux(ParameterizedTypeReference<T> typeReference)
Extract the body to a
Flux . |
<T> <any> |
bodyToMono(java.lang.Class<? extends T> elementClass)
Extract the body to a
Mono . |
<T> <any> |
bodyToMono(ParameterizedTypeReference<T> typeReference)
Extract the body to a
Mono . |
MultiValueMap<java.lang.String,ResponseCookie> |
cookies()
Return cookies of this response.
|
private <T> ResponseEntity<T> |
createEntity(HttpHeaders headers,
int status) |
private <T> ResponseEntity<T> |
createEntity(T body,
HttpHeaders headers,
int status) |
ClientResponse.Headers |
headers()
Return the headers of this response.
|
int |
rawStatusCode()
Return the (potentially non-standard) status code of this response.
|
HttpStatus |
statusCode()
Return the status code of this response.
|
ExchangeStrategies |
strategies()
Return the strategies used to convert the body of this response.
|
<T> <any> |
toEntity(java.lang.Class<T> bodyType)
Return this response as a delayed
ResponseEntity . |
<T> <any> |
toEntity(ParameterizedTypeReference<T> typeReference)
Return this response as a delayed
ResponseEntity . |
private <T> <any> |
toEntityInternal(<any> bodyMono) |
<T> <any> |
toEntityList(java.lang.Class<T> responseType)
Return this response as a delayed list of
ResponseEntity s. |
<T> <any> |
toEntityList(ParameterizedTypeReference<T> typeReference)
Return this response as a delayed list of
ResponseEntity s. |
private <T> <any> |
toEntityListInternal(<any> bodyFlux) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, create, create, from
private final ClientHttpResponse response
private final ClientResponse.Headers headers
private final ExchangeStrategies strategies
private final java.lang.String logPrefix
private final java.lang.String requestDescription
public DefaultClientResponse(ClientHttpResponse response, ExchangeStrategies strategies, java.lang.String logPrefix, java.lang.String requestDescription)
public ExchangeStrategies strategies()
ClientResponse
strategies
in interface ClientResponse
public HttpStatus statusCode()
ClientResponse
statusCode
in interface ClientResponse
HttpStatus.valueOf(int)
public int rawStatusCode()
ClientResponse
rawStatusCode
in interface ClientResponse
ClientResponse.statusCode()
,
HttpStatus.resolve(int)
public ClientResponse.Headers headers()
ClientResponse
headers
in interface ClientResponse
public MultiValueMap<java.lang.String,ResponseCookie> cookies()
ClientResponse
cookies
in interface ClientResponse
public <T> T body(BodyExtractor<T,? super ClientHttpResponse> extractor)
ClientResponse
BodyExtractor
.body
in interface ClientResponse
T
- the type of the body returnedextractor
- the BodyExtractor
that reads from the responsepublic <T> <any> bodyToMono(java.lang.Class<? extends T> elementClass)
ClientResponse
Mono
.bodyToMono
in interface ClientResponse
T
- the element typeelementClass
- the class of element in the Mono
T
public <T> <any> bodyToMono(ParameterizedTypeReference<T> typeReference)
ClientResponse
Mono
.bodyToMono
in interface ClientResponse
T
- the element typetypeReference
- a type reference describing the expected response body typeT
public <T> <any> bodyToFlux(java.lang.Class<? extends T> elementClass)
ClientResponse
Flux
.bodyToFlux
in interface ClientResponse
T
- the element typeelementClass
- the class of element in the Flux
T
public <T> <any> bodyToFlux(ParameterizedTypeReference<T> typeReference)
ClientResponse
Flux
.bodyToFlux
in interface ClientResponse
T
- the element typetypeReference
- a type reference describing the expected response body typeT
public <T> <any> toEntity(java.lang.Class<T> bodyType)
ClientResponse
ResponseEntity
.toEntity
in interface ClientResponse
T
- response body typebodyType
- the expected response body typeMono
with the ResponseEntity
public <T> <any> toEntity(ParameterizedTypeReference<T> typeReference)
ClientResponse
ResponseEntity
.toEntity
in interface ClientResponse
T
- response body typetypeReference
- a type reference describing the expected response body typeMono
with the ResponseEntity
private <T> <any> toEntityInternal(<any> bodyMono)
public <T> <any> toEntityList(java.lang.Class<T> responseType)
ClientResponse
ResponseEntity
s.toEntityList
in interface ClientResponse
T
- the type of elements in the listresponseType
- the expected response body list element typeMono
with the list of ResponseEntity
spublic <T> <any> toEntityList(ParameterizedTypeReference<T> typeReference)
ClientResponse
ResponseEntity
s.toEntityList
in interface ClientResponse
T
- the type of elements in the listtypeReference
- a type reference describing the expected response body typeMono
with the list of ResponseEntity
sprivate <T> <any> toEntityListInternal(<any> bodyFlux)
private <T> ResponseEntity<T> createEntity(HttpHeaders headers, int status)
private <T> ResponseEntity<T> createEntity(T body, HttpHeaders headers, int status)