Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.function.client

pack-priv final Class DefaultClientResponseBuilder

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.function.client.ClientResponse.Builder
Imports
java.net.URI, java.nio.charset.StandardCharsets, java.util.function.Consumer, .Function, reactor.core.publisher.Flux, org.springframework.core.io.buffer.DataBuffer, .DataBufferUtils, .DefaultDataBufferFactory, org.springframework.http.HttpHeaders, .HttpMethod, .HttpRequest, .HttpStatus, .HttpStatusCode, .ResponseCookie, org.springframework.http.client.reactive.ClientHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .LinkedMultiValueMap, .MultiValueMap

Default implementation of ClientResponse.Builder.
Author
Arjen Poutsma
Since
5.0.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Flux<DataBuffer>
private MultiValueMap<String, ResponseCookie>
private static final HttpRequest
private HttpHeaders
private ClientResponse
private HttpRequest
private HttpStatusCode
private final ExchangeStrategies

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ClientResponse.Builder
body(Function<Flux<DataBuffer>, Flux<DataBuffer>>
the transformation function to use
transformer
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Transform the response body, if set in the builder.

public ClientResponse.Builder
body(Flux<DataBuffer>
the new body to use
body
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Set the body of the response.

public ClientResponse.Builder
body(String
the new body.
body
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Set the body of the response to the UTF-8 encoded bytes of the given string.

public ClientResponse
public ClientResponse.Builder
cookies(Consumer<MultiValueMap<String, ResponseCookie>>
a function that consumes the cookies map
cookiesConsumer
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.cookies.

Manipulate this response's cookies with the given consumer.

private MultiValueMap<String, ResponseCookie>
private HttpHeaders
public ClientResponse.Builder
header(String
the header name
headerName
,
String...
the header value(s)
headerValues
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.header.

Add the given header value(s) under the given name.

public ClientResponse.Builder
headers(Consumer<HttpHeaders>
a function that consumes the HttpHeaders
headersConsumer
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.headers.

Manipulate this response's headers with the given consumer.

public DefaultClientResponseBuilder
rawStatusCode(int
the new status code
statusCode
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.rawStatusCode.

Set the raw status code of the response.

private void
public ClientResponse.Builder
request(HttpRequest
the request
request
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.request.

Set the request associated with the response.

public DefaultClientResponseBuilder
statusCode(HttpStatusCode
the new status code
statusCode
)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.statusCode.

Set the status code of the response.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyback to summary
private Flux<DataBuffer> body
cookiesback to summary
private MultiValueMap<String, ResponseCookie> cookies
Annotations
@Nullable
EMPTY_REQUESTback to summary
private static final HttpRequest EMPTY_REQUEST
headersback to summary
private HttpHeaders headers
Annotations
@Nullable
originalResponseback to summary
private ClientResponse originalResponse
Annotations
@Nullable
requestback to summary
private HttpRequest request
statusCodeback to summary
private HttpStatusCode statusCode
strategiesback to summary
private final ExchangeStrategies strategies

Constructor Detail

DefaultClientResponseBuilderback to summary
pack-priv DefaultClientResponseBuilder(ExchangeStrategies strategies)
DefaultClientResponseBuilderback to summary
pack-priv DefaultClientResponseBuilder(ClientResponse other, boolean mutate)

Method Detail

bodyback to summary
public ClientResponse.Builder body(Function<Flux<DataBuffer>, Flux<DataBuffer>> transformer)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Transform the response body, if set in the builder.

Parameters
transformer:Function<Flux<DataBuffer>, Flux<DataBuffer>>

the transformation function to use

Returns:ClientResponse.Builder

this builder

Annotations
@Override
bodyback to summary
public ClientResponse.Builder body(Flux<DataBuffer> body)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Set the body of the response.

Note

This method will drain the existing body, if set in the builder.

Parameters
body:Flux<DataBuffer>

the new body to use

Returns:ClientResponse.Builder

this builder

Annotations
@Override
bodyback to summary
public ClientResponse.Builder body(String body)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.body.

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.

Parameters
body:String

the new body.

Returns:ClientResponse.Builder

this builder

Annotations
@Override
buildback to summary
public ClientResponse build()

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.build.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.build.

Build the response.

Annotations
@Override
cookiesback to summary
public ClientResponse.Builder cookies(Consumer<MultiValueMap<String, ResponseCookie>> cookiesConsumer)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.cookies.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.cookies.

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 MultiValueMap methods.

Parameters
cookiesConsumer:Consumer<MultiValueMap<String, ResponseCookie>>

a function that consumes the cookies map

Returns:ClientResponse.Builder

this builder

Annotations
@Override
getCookiesback to summary
private MultiValueMap<String, ResponseCookie> getCookies()
Annotations
@SuppressWarnings:ConstantConditions
getHeadersback to summary
private HttpHeaders getHeaders()
Annotations
@SuppressWarnings:ConstantConditions
headerback to summary
public ClientResponse.Builder header(String headerName, String... headerValues)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.header.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.header.

Add the given header value(s) under the given name.

Parameters
headerName:String

the header name

headerValues:String[]

the header value(s)

Returns:ClientResponse.Builder

this builder

Annotations
@Override
headersback to summary
public ClientResponse.Builder headers(Consumer<HttpHeaders> headersConsumer)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.headers.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.headers.

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 HttpHeaders methods.

Parameters
headersConsumer:Consumer<HttpHeaders>

a function that consumes the HttpHeaders

Returns:ClientResponse.Builder

this builder

Annotations
@Override
rawStatusCodeback to summary
public DefaultClientResponseBuilder rawStatusCode(int statusCode)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.rawStatusCode.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.rawStatusCode.

Set the raw status code of the response.

Parameters
statusCode:int

the new status code

Returns:DefaultClientResponseBuilder

this builder

Annotations
@Override
releaseBodyback to summary
private void releaseBody()
requestback to summary
public ClientResponse.Builder request(HttpRequest request)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.request.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.request.

Set the request associated with the response.

Parameters
request:HttpRequest

the request

Returns:ClientResponse.Builder

this builder

Annotations
@Override
statusCodeback to summary
public DefaultClientResponseBuilder statusCode(HttpStatusCode statusCode)

Implements org.springframework.web.reactive.function.client.ClientResponse.Builder.statusCode.

Doc from org.springframework.web.reactive.function.client.ClientResponse.Builder.statusCode.

Set the status code of the response.

Parameters
statusCode:HttpStatusCode

the new status code

Returns:DefaultClientResponseBuilder

this builder

Annotations
@Override
org.springframework.web.reactive.function.client back to summary

private Class DefaultClientResponseBuilder.BuiltClientHttpResponse

extends Object
implements ClientHttpResponse
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.function.client.DefaultClientResponseBuilder.BuiltClientHttpResponse
All Implemented Interfaces
org.springframework.http.client.reactive.ClientHttpResponse, org.springframework.http.ReactiveHttpInputMessage, org.springframework.http.HttpMessage

Field Summary

Modifier and TypeField and Description
private final Flux<DataBuffer>
private final MultiValueMap<String, ResponseCookie>
private final HttpHeaders
private final ClientResponse
private final HttpStatusCode

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Flux<DataBuffer>
getBody()

Implements org.springframework.http.ReactiveHttpInputMessage.getBody.

Return the body of the message as a Publisher.

public MultiValueMap<String, ResponseCookie>
getCookies()

Implements org.springframework.http.client.reactive.ClientHttpResponse.getCookies.

Return a read-only map of response cookies received from the server.

public HttpHeaders
getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

public HttpStatusCode
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyback to summary
private final Flux<DataBuffer> body
cookiesback to summary
private final MultiValueMap<String, ResponseCookie> cookies
Annotations
@Nullable
headersback to summary
private final HttpHeaders headers
Annotations
@Nullable
originalResponseback to summary
private final ClientResponse originalResponse
Annotations
@Nullable
statusCodeback to summary
private final HttpStatusCode statusCode

Constructor Detail

BuiltClientHttpResponseback to summary
pack-priv BuiltClientHttpResponse(HttpStatusCode statusCode, HttpHeaders headers, MultiValueMap<String, ResponseCookie> cookies, Flux<DataBuffer> body, ClientResponse originalResponse)

Method Detail

getBodyback to summary
public Flux<DataBuffer> getBody()

Implements org.springframework.http.ReactiveHttpInputMessage.getBody.

Doc from org.springframework.http.ReactiveHttpInputMessage.getBody.

Return the body of the message as a Publisher.

Returns:Flux<DataBuffer>

the body content publisher

Annotations
@Override
getCookiesback to summary
public MultiValueMap<String, ResponseCookie> getCookies()

Implements org.springframework.http.client.reactive.ClientHttpResponse.getCookies.

Doc from org.springframework.http.client.reactive.ClientHttpResponse.getCookies.

Return a read-only map of response cookies received from the server.

Annotations
@Override
@SuppressWarnings:ConstantConditions
getHeadersback to summary
public HttpHeaders getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override
@SuppressWarnings:ConstantConditions
getStatusCodeback to summary
public HttpStatusCode getStatusCode()

Implements org.springframework.http.client.reactive.ClientHttpResponse.getStatusCode.

Doc from org.springframework.http.client.reactive.ClientHttpResponse.getStatusCode.

Return the HTTP status code as an HttpStatusCode.

Returns:HttpStatusCode

the HTTP status as HttpStatusCode value (never null)

Annotations
@Override