接口 ClientResponse.Builder
- 封闭接口:
- ClientResponse
public static interface ClientResponse.Builder
Defines a builder for a response.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ClientResponse.Builder
body(String body)
Set the body of the response to the UTF-8 encoded bytes of the given string.ClientResponse.Builder
body(reactor.core.publisher.Flux<DataBuffer> body)
Set the body of the response.ClientResponse
build()
Build the response.ClientResponse.Builder
cookie(String name, String... values)
Add a cookie with the given name and value(s).ClientResponse.Builder
cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.ClientResponse.Builder
header(String headerName, String... headerValues)
Add the given header value(s) under the given name.ClientResponse.Builder
headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this response's headers with the given consumer.ClientResponse.Builder
rawStatusCode(int statusCode)
Set the raw status code of the response.ClientResponse.Builder
request(HttpRequest request)
Set the request associated with the response.ClientResponse.Builder
statusCode(HttpStatus statusCode)
Set the status code of the response.
方法详细资料
statusCode
ClientResponse.Builder statusCode(HttpStatus statusCode)
Set the status code of the response.- 参数:
statusCode
- the new status code- 返回:
- this builder
rawStatusCode
ClientResponse.Builder rawStatusCode(int statusCode)
Set the raw status code of the response.- 参数:
statusCode
- the new status code- 返回:
- this builder
- 从以下版本开始:
- 5.1.9
header
ClientResponse.Builder header(String headerName, String... headerValues)
Add the given header value(s) under the given name.- 参数:
headerName
- the header nameheaderValues
- the header value(s)- 返回:
- this builder
- 另请参阅:
HttpHeaders.add(String, String)
headers
ClientResponse.Builder headers(Consumer<HttpHeaders> headersConsumer)
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.- 参数:
headersConsumer
- a function that consumes theHttpHeaders
- 返回:
- this builder
cookie
ClientResponse.Builder cookie(String name, String... values)
Add a cookie with the given name and value(s).- 参数:
name
- the cookie namevalues
- the cookie value(s)- 返回:
- this builder
cookies
ClientResponse.Builder cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
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.- 参数:
cookiesConsumer
- a function that consumes the cookies map- 返回:
- this builder
body
ClientResponse.Builder body(reactor.core.publisher.Flux<DataBuffer> body)
Set the body of the response.Calling this methods will release the existing body of the builder.
- 参数:
body
- the new body- 返回:
- this builder
body
ClientResponse.Builder body(String body)
Set the body of the response to the UTF-8 encoded bytes of the given string.Calling this methods will release the existing body of the builder.
- 参数:
body
- the new body- 返回:
- this builder
request
ClientResponse.Builder request(HttpRequest request)
Set the request associated with the response.- 参数:
request
- the request- 返回:
- this builder
- 从以下版本开始:
- 5.2
build
ClientResponse build()
Build the response.