WebClient and also
ExchangeFunction. Provides access to the response status and
headers, and also methods to consume the response body.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ClientResponse.
Defines a builder for a response. |
| public static interface | ClientResponse.
Represents the headers of the HTTP response. |
| Modifier and Type | Method and Description |
|---|---|
| public < the type of the body returned T> T | Returns: the extracted bodythe extractor)BodyExtractor that reads from the responseExtract the body with the given |
| public < the element type T> Flux | Returns: a flux containing the body of the given typeTthe class of elements in the elementClass)FluxExtract the body to a |
| public < the element type T> Flux | Returns: a flux containing the body of the given typeTthe type reference of elements in the elementTypeRef)FluxExtract the body to a |
| public < the element type T> Mono | Returns: a mono containing the body of the given typeTthe class of element in the elementClass)MonoExtract the body to a |
| public < the element type T> Mono | Returns: a mono containing the body of the given typeTthe type reference of element in the elementTypeRef)MonoExtract the body to a |
| public MultiValueMap | |
| public static ClientResponse. | Returns: the created builderthe status code statusCode)Create a response builder with the given status code and using default strategies for reading the body. |
| public static ClientResponse. | Returns: the created builderthe status code statusCode, ExchangeStrategies the strategies strategies)Create a response builder with the given status code and strategies for reading the body. |
| public static ClientResponse. | Returns: the created builderthe status code statusCode, ExchangeStrategies the strategies strategies)Create a response builder with the given raw status code and strategies for reading the body. |
| public static ClientResponse. | Returns: the created builderthe status code statusCode, List<HttpMessageReader<?>> the message readers messageReaders)Create a response builder with the given status code and message body readers. |
| public < the reified type T> Mono | createError()
Create a |
| public Mono | Returns: aMono with the created exceptionCreate a |
| public static ClientResponse. | Returns: the created builderthe response to copy the status, headers, and cookies from other)
Deprecated
as of 5.3 in favor of the instance based
mutate().
Create a builder with the status, headers, and cookies of the given response. |
| public ClientResponse. | |
| public String | Returns: the log message prefix or an empty String if theLOG_ID_ATTRIBUTE is not setReturn a log message prefix to use to correlate messages for this exchange. |
| public default ClientResponse. | Returns: a builder to mutate the response withReturn a builder to mutate this response, for example to change the status, headers, cookies, and replace or transform the body. |
| public Mono | |
| public HttpRequest | |
| public HttpStatusCode | Returns: the HTTP status as an HttpStatusCode value (nevernull)Return the HTTP status code as an |
| public ExchangeStrategies | |
| public Mono | Returns: Mono with the bodiless ResponseEntityReturn this response as a delayed |
| public < response body type T> Mono | |
| public < response body type T> Mono | Returns: Mono with the ResponseEntitya type reference describing the expected response body type bodyTypeReference)Return this response as a delayed |
| public < the type of elements in the list T> Mono | Returns: Mono with the list of ResponseEntitysthe expected response body list element class elementClass)Return this response as a delayed list of |
| public < the type of elements in the list T> Mono | Returns: Mono with the list of ResponseEntitysthe expected response body list element reference type elementTypeRef)Return this response as a delayed list of |
| body | back to summary |
|---|---|
| public <T> T body(BodyExtractor<T, ? super ClientHttpResponse> extractor) Extract the body with the given
| |
| bodyToFlux | back to summary |
|---|---|
| public <T> Flux Extract the body to a | |
| bodyToFlux | back to summary |
|---|---|
| public <T> Flux Extract the body to a
| |
| bodyToMono | back to summary |
|---|---|
| public <T> Mono Extract the body to a | |
| bodyToMono | back to summary |
|---|---|
| public <T> Mono Extract the body to a
| |
| cookies | back to summary |
|---|---|
| public MultiValueMap Return the cookies of this response. | |
| create | back to summary |
|---|---|
| public static ClientResponse. Create a response builder with the given status code and using default strategies for reading the body.
| |
| create | back to summary |
|---|---|
| public static ClientResponse. Create a response builder with the given status code and strategies for reading the body.
| |
| create | back to summary |
|---|---|
| public static ClientResponse. Create a response builder with the given raw status code and strategies for reading the body.
| |
| create | back to summary |
|---|---|
| public static ClientResponse. Create a response builder with the given status code and message body readers.
| |
| createError | back to summary |
|---|---|
| public <T> Mono Create a
| |
| createException | back to summary |
|---|---|
| public Mono Create a
| |
| from | back to summary |
|---|---|
| public static ClientResponse. Deprecated as of 5.3 in favor of the instance based Create a builder with the status, headers, and cookies of the given response. Note Note that the body in the returned builder is
| |
| headers | back to summary |
|---|---|
| public ClientResponse. Return the headers of this response. | |
| logPrefix | back to summary |
|---|---|
| public String logPrefix() 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
| |
| mutate | back to summary |
|---|---|
| public default ClientResponse. Return a builder to mutate this response, for example to change the status, headers, cookies, and replace or transform the body.
| |
| releaseBody | back to summary |
|---|---|
| public Mono Release the body of this response.
| |
| request | back to summary |
|---|---|
| public HttpRequest request() Return the request associated with the response.
| |
| statusCode | back to summary |
|---|---|
| public HttpStatusCode statusCode() Return the HTTP status code as an
| |
| strategies | back to summary |
|---|---|
| public ExchangeStrategies strategies() Return the strategies used to convert the body of this response. | |
| toBodilessEntity | back to summary |
|---|---|
| public Mono Return this response as a delayed
| |
| toEntity | back to summary |
|---|---|
| public <T> Mono Return this response as a delayed
| |
| toEntity | back to summary |
|---|---|
| public <T> Mono Return this response as a delayed
| |
| toEntityList | back to summary |
|---|---|
| public <T> Mono Return this response as a delayed list of
| |
| toEntityList | back to summary |
|---|---|
| public <T> Mono Return this response as a delayed list of
| |
| Modifier and Type | Method and Description |
|---|---|
| public ClientResponse. | Returns: this builderthe transformation function to use transformer)Transform the response body, if set in the builder. |
| public ClientResponse. | |
| public ClientResponse. | |
| public ClientResponse | |
| public ClientResponse. | |
| public ClientResponse. | Returns: this buildera function that consumes the cookies map cookiesConsumer)Manipulate this response's cookies with the given consumer. |
| public ClientResponse. | |
| public ClientResponse. | Returns: this buildera function that consumes the headersConsumer)HttpHeadersManipulate this response's headers with the given consumer. |
| public ClientResponse. | Returns: this builderthe new status code statusCode)Set the raw status code of the response. |
| public ClientResponse. | Returns: this builderthe request request)Set the request associated with the response. |
| public ClientResponse. | Returns: this builderthe new status code statusCode)Set the status code of the response. |
| body | back to summary |
|---|---|
| public ClientResponse. Transform the response body, if set in the builder.
| |
| body | back to summary |
|---|---|
| public ClientResponse. Set the body of the response. Note This method will drain the existing body, if set in the builder.
| |
| body | back to summary |
|---|---|
| public ClientResponse. Set the body of the response to the UTF-8 encoded bytes of the given string. Note This method will drain the existing body, if set in the builder.
| |
| build | back to summary |
|---|---|
| public ClientResponse build() Build the response. | |
| cookie | back to summary |
|---|---|
| public ClientResponse. Add a cookie with the given name and value(s).
| |
| cookies | back to summary |
|---|---|
| public ClientResponse. Manipulate this response's cookies with the given consumer. The map provided to the consumer is "live", so that the consumer can be used to
overwrite existing cookie values,
remove values, or use any of the other
| |
| header | back to summary |
|---|---|
| public ClientResponse. Add the given header value(s) under the given name.
| |
| headers | back to summary |
|---|---|
| public ClientResponse. Manipulate this response's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer
can be used to overwrite
existing header values, remove
values, or use any of the other
| |
| rawStatusCode | back to summary |
|---|---|
| public ClientResponse. Set the raw status code of the response.
| |
| request | back to summary |
|---|---|
| public ClientResponse. Set the request associated with the response.
| |
| statusCode | back to summary |
|---|---|
| public ClientResponse. Set the status code of the response.
| |
ClientResponse#headers()
| Modifier and Type | Method and Description |
|---|---|
| public HttpHeaders | |
| public OptionalLong | |
| public Optional | |
| public List |
| asHttpHeaders | back to summary |
|---|---|
| public HttpHeaders asHttpHeaders() Return the headers as an | |
| contentLength | back to summary |
|---|---|
| public OptionalLong contentLength() Return the length of the body in bytes, as specified by the
| |
| contentType | back to summary |
|---|---|
| public Optional Return the media type of the body, as specified
by the | |
| header | back to summary |
|---|---|
| public List Return the header value(s), if any, for the header of the given name. Return an empty list if no header values are found.
| |