org.springframework.web.reactive.function.client

Interface ClientResponse.Builder

  • Enclosing interface:
    ClientResponse


    public static interface ClientResponse.Builder
    Defines a builder for a response.
    • Method Detail

      • statusCode

        ClientResponse.Builder statusCode(HttpStatus statusCode)
        Set the status code of the response.
        Parameters:
        statusCode - the new status code.
        Returns:
        this builder
      • header

        ClientResponse.Builder header(java.lang.String headerName,
                                      java.lang.String... headerValues)
        Add the given header value(s) under the given name.
        Parameters:
        headerName - the header name
        headerValues - the header value(s)
        Returns:
        this builder
        See Also:
        HttpHeaders.add(String, String)
      • headers

        ClientResponse.Builder headers(java.util.function.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.
        Parameters:
        headersConsumer - a function that consumes the HttpHeaders
        Returns:
        this builder
      • cookie

        ClientResponse.Builder cookie(java.lang.String name,
                                      java.lang.String... values)
        Add a cookie with the given name and value(s).
        Parameters:
        name - the cookie name
        values - the cookie value(s)
        Returns:
        this builder
      • cookies

        ClientResponse.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.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 header values, remove values, or use any of the other MultiValueMap methods.
        Parameters:
        cookiesConsumer - a function that consumes the cookies map
        Returns:
        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.
        Parameters:
        body - the new body.
        Returns:
        this builder
      • body

        ClientResponse.Builder body(java.lang.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.
        Parameters:
        body - the new body.
        Returns:
        this builder