final class DefaultClientResponseBuilder extends java.lang.Object implements ClientResponse.Builder
ClientResponse.Builder
.Modifier and Type | Class and Description |
---|---|
private static class |
DefaultClientResponseBuilder.BuiltClientHttpResponse |
Modifier and Type | Field and Description |
---|---|
private <any> |
body |
private MultiValueMap<java.lang.String,ResponseCookie> |
cookies |
private HttpHeaders |
headers |
private HttpStatus |
statusCode |
private ExchangeStrategies |
strategies |
Constructor and Description |
---|
DefaultClientResponseBuilder(ClientResponse other) |
DefaultClientResponseBuilder(ExchangeStrategies strategies) |
Modifier and Type | Method and Description |
---|---|
ClientResponse.Builder |
body(<any> body)
Set the body of the response.
|
ClientResponse |
build()
Build the response.
|
DefaultClientResponseBuilder |
cookie(java.lang.String name,
java.lang.String... values)
Add a cookie with the given name and value(s).
|
ClientResponse.Builder |
cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.
|
ClientResponse.Builder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header value(s) under the given name.
|
ClientResponse.Builder |
headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate this response's headers with the given consumer.
|
private void |
releaseBody() |
DefaultClientResponseBuilder |
statusCode(HttpStatus statusCode)
Set the status code of the response.
|
private ExchangeStrategies strategies
private HttpStatus statusCode
private final HttpHeaders headers
private final MultiValueMap<java.lang.String,ResponseCookie> cookies
private <any> body
public DefaultClientResponseBuilder(ExchangeStrategies strategies)
public DefaultClientResponseBuilder(ClientResponse other)
public DefaultClientResponseBuilder statusCode(HttpStatus statusCode)
ClientResponse.Builder
statusCode
in interface ClientResponse.Builder
statusCode
- the new status code.public ClientResponse.Builder header(java.lang.String headerName, java.lang.String... headerValues)
ClientResponse.Builder
header
in interface ClientResponse.Builder
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
public ClientResponse.Builder headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
ClientResponse.Builder
HttpHeaders
methods.headers
in interface ClientResponse.Builder
headersConsumer
- a function that consumes the HttpHeaders
public DefaultClientResponseBuilder cookie(java.lang.String name, java.lang.String... values)
ClientResponse.Builder
cookie
in interface ClientResponse.Builder
name
- the cookie namevalues
- the cookie value(s)public ClientResponse.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,ResponseCookie>> cookiesConsumer)
ClientResponse.Builder
MultiValueMap
methods.cookies
in interface ClientResponse.Builder
cookiesConsumer
- a function that consumes the cookies mappublic ClientResponse.Builder body(<any> body)
ClientResponse.Builder
body
in interface ClientResponse.Builder
body
- the new body.private void releaseBody()
public ClientResponse build()
ClientResponse.Builder
build
in interface ClientResponse.Builder