接口 ClientResponse.Builder

所有已知实现类:
DefaultClientResponseBuilder
封闭接口:
ClientResponse

public static interface ClientResponse.Builder
Defines a builder for a response.
  • 方法详细资料

    • statusCode

      ClientResponse.Builder statusCode(HttpStatusCode 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
    • header

      ClientResponse.Builder header(String headerName, String... headerValues)
      Add the given header value(s) under the given name.
      参数:
      headerName - the header name
      headerValues - the header value(s)
      返回:
      this builder
      另请参阅:
    • 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 the HttpHeaders
      返回:
      this builder
    • cookie

      ClientResponse.Builder cookie(String name, String... values)
      Add a cookie with the given name and value(s).
      参数:
      name - the cookie name
      values - the cookie value(s)
      返回:
      this builder
    • cookies

      ClientResponse.Builder cookies(Consumer<cn.taketoday.util.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(Function<reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer>,reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer>> transformer)
      Transform the response body, if set in the builder.
      参数:
      transformer - the transformation function to use
      返回:
      this builder
    • body

      ClientResponse.Builder body(reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> body)
      Set the body of the response.

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

      参数:
      body - the new body to use
      返回:
      this 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.

      参数:
      body - the new body.
      返回:
      this builder
    • request

      Set the request associated with the response.
      参数:
      request - the request
      返回:
      this builder
    • build

      Build the response.