类 ClientResponseWrapper
- java.lang.Object
- org.springframework.web.reactive.function.client.support.ClientResponseWrapper
- 所有已实现的接口:
ClientResponse
public class ClientResponseWrapper extends Object implements ClientResponse
Implementation of theClientResponse
interface that can be subclassed to adapt the request in aexchange filter function
. All methods default to calling through to the wrapped request.- 从以下版本开始:
- 5.0.5
- 作者:
- Arjen Poutsma
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
ClientResponseWrapper.HeadersWrapper
Implementation of theHeaders
interface that can be subclassed to adapt the headers in aexchange filter function
.从接口继承的嵌套类/接口 org.springframework.web.reactive.function.client.ClientResponse
ClientResponse.Builder, ClientResponse.Headers
构造器概要
构造器 构造器 说明 ClientResponseWrapper(ClientResponse delegate)
Create a newClientResponseWrapper
that wraps the given response.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 <T> T
body(BodyExtractor<T,? super ClientHttpResponse> extractor)
Extract the body with the givenBodyExtractor
.<T> reactor.core.publisher.Flux<T>
bodyToFlux(Class<? extends T> elementClass)
Extract the body to aFlux
.<T> reactor.core.publisher.Flux<T>
bodyToFlux(ParameterizedTypeReference<T> elementTypeRef)
Extract the body to aFlux
.<T> reactor.core.publisher.Mono<T>
bodyToMono(Class<? extends T> elementClass)
Extract the body to aMono
.<T> reactor.core.publisher.Mono<T>
bodyToMono(ParameterizedTypeReference<T> elementTypeRef)
Extract the body to aMono
.MultiValueMap<String,ResponseCookie>
cookies()
Return the cookies of this response.reactor.core.publisher.Mono<WebClientResponseException>
createException()
Create aWebClientResponseException
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 anHttpStatus
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 delayedResponseEntity
containing status and headers, but no body.<T> reactor.core.publisher.Mono<ResponseEntity<T>>
toEntity(Class<T> bodyType)
Return this response as a delayedResponseEntity
.<T> reactor.core.publisher.Mono<ResponseEntity<T>>
toEntity(ParameterizedTypeReference<T> bodyTypeReference)
Return this response as a delayedResponseEntity
.<T> reactor.core.publisher.Mono<ResponseEntity<List<T>>>
toEntityList(Class<T> elementClass)
Return this response as a delayed list ofResponseEntity
s.<T> reactor.core.publisher.Mono<ResponseEntity<List<T>>>
toEntityList(ParameterizedTypeReference<T> elementTypeRef)
Return this response as a delayed list ofResponseEntity
s.
构造器详细资料
ClientResponseWrapper
public ClientResponseWrapper(ClientResponse delegate)
Create a newClientResponseWrapper
that wraps the given response.- 参数:
delegate
- the response to wrap
方法详细资料
response
public ClientResponse response()
Return the wrapped request.
strategies
public ExchangeStrategies strategies()
从接口复制的说明:ClientResponse
Return the strategies used to convert the body of this response.- 指定者:
strategies
在接口中ClientResponse
statusCode
public HttpStatus statusCode()
从接口复制的说明:ClientResponse
Return the HTTP status code as anHttpStatus
enum value.- 指定者:
statusCode
在接口中ClientResponse
- 返回:
- the HTTP status as an HttpStatus enum value (never
null
) - 另请参阅:
HttpStatus.valueOf(int)
rawStatusCode
public int rawStatusCode()
从接口复制的说明:ClientResponse
Return the (potentially non-standard) status code of this response.- 指定者:
rawStatusCode
在接口中ClientResponse
- 返回:
- the HTTP status as an integer value
- 另请参阅:
ClientResponse.statusCode()
,HttpStatus.resolve(int)
headers
public ClientResponse.Headers headers()
从接口复制的说明:ClientResponse
Return the headers of this response.- 指定者:
headers
在接口中ClientResponse
cookies
public MultiValueMap<String,ResponseCookie> cookies()
从接口复制的说明:ClientResponse
Return the cookies of this response.- 指定者:
cookies
在接口中ClientResponse
body
public <T> T body(BodyExtractor<T,? super ClientHttpResponse> extractor)
从接口复制的说明:ClientResponse
Extract the body with the givenBodyExtractor
.- 指定者:
body
在接口中ClientResponse
- 类型参数:
T
- the type of the body returned- 参数:
extractor
- theBodyExtractor
that reads from the response- 返回:
- the extracted body
bodyToMono
public <T> reactor.core.publisher.Mono<T> bodyToMono(Class<? extends T> elementClass)
从接口复制的说明:ClientResponse
Extract the body to aMono
.- 指定者:
bodyToMono
在接口中ClientResponse
- 类型参数:
T
- the element type- 参数:
elementClass
- the class of element in theMono
- 返回:
- a mono containing the body of the given type
T
bodyToMono
public <T> reactor.core.publisher.Mono<T> bodyToMono(ParameterizedTypeReference<T> elementTypeRef)
从接口复制的说明:ClientResponse
Extract the body to aMono
.- 指定者:
bodyToMono
在接口中ClientResponse
- 类型参数:
T
- the element type- 参数:
elementTypeRef
- the type reference of element in theMono
- 返回:
- a mono containing the body of the given type
T
bodyToFlux
public <T> reactor.core.publisher.Flux<T> bodyToFlux(Class<? extends T> elementClass)
从接口复制的说明:ClientResponse
Extract the body to aFlux
.- 指定者:
bodyToFlux
在接口中ClientResponse
- 类型参数:
T
- the element type- 参数:
elementClass
- the class of elements in theFlux
- 返回:
- a flux containing the body of the given type
T
bodyToFlux
public <T> reactor.core.publisher.Flux<T> bodyToFlux(ParameterizedTypeReference<T> elementTypeRef)
从接口复制的说明:ClientResponse
Extract the body to aFlux
.- 指定者:
bodyToFlux
在接口中ClientResponse
- 类型参数:
T
- the element type- 参数:
elementTypeRef
- the type reference of elements in theFlux
- 返回:
- a flux containing the body of the given type
T
releaseBody
public reactor.core.publisher.Mono<Void> releaseBody()
从接口复制的说明:ClientResponse
Release the body of this response.- 指定者:
releaseBody
在接口中ClientResponse
- 返回:
- a completion signal
- 另请参阅:
DataBufferUtils.release(DataBuffer)
toBodilessEntity
public reactor.core.publisher.Mono<ResponseEntity<Void>> toBodilessEntity()
从接口复制的说明:ClientResponse
Return this response as a delayedResponseEntity
containing status and headers, but no body. Calling this method will release the body of the response.- 指定者:
toBodilessEntity
在接口中ClientResponse
- 返回:
Mono
with the bodilessResponseEntity
toEntity
public <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(Class<T> bodyType)
从接口复制的说明:ClientResponse
Return this response as a delayedResponseEntity
.- 指定者:
toEntity
在接口中ClientResponse
- 类型参数:
T
- response body type- 参数:
bodyType
- the expected response body type- 返回:
Mono
with theResponseEntity
toEntity
public <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> bodyTypeReference)
从接口复制的说明:ClientResponse
Return this response as a delayedResponseEntity
.- 指定者:
toEntity
在接口中ClientResponse
- 类型参数:
T
- response body type- 参数:
bodyTypeReference
- a type reference describing the expected response body type- 返回:
Mono
with theResponseEntity
toEntityList
public <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList(Class<T> elementClass)
从接口复制的说明:ClientResponse
Return this response as a delayed list ofResponseEntity
s.- 指定者:
toEntityList
在接口中ClientResponse
- 类型参数:
T
- the type of elements in the list- 参数:
elementClass
- the expected response body list element class- 返回:
Mono
with the list ofResponseEntity
s
toEntityList
public <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList(ParameterizedTypeReference<T> elementTypeRef)
从接口复制的说明:ClientResponse
Return this response as a delayed list ofResponseEntity
s.- 指定者:
toEntityList
在接口中ClientResponse
- 类型参数:
T
- the type of elements in the list- 参数:
elementTypeRef
- the expected response body list element reference type- 返回:
Mono
with the list ofResponseEntity
s
createException
public reactor.core.publisher.Mono<WebClientResponseException> createException()
从接口复制的说明:ClientResponse
Create aWebClientResponseException
that contains the response status, headers, body, and the originating request.- 指定者:
createException
在接口中ClientResponse
- 返回:
- a
Mono
with the created exception
logPrefix
public String logPrefix()
从接口复制的说明:ClientResponse
Return a log message prefix to use to correlate messages for this exchange.The 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
在接口中ClientResponse
- 返回:
- the log message prefix or an empty String if the
LOG_ID_ATTRIBUTE
is not set