org.springframework.web.reactive.function.server

## Interface EntityResponse.Builder<T>

- Type Parameters:
    `T` - a self reference to the builder type
  Enclosing interface:
    EntityResponse<T>

      public static interface EntityResponse.Builder<T>

  Defines a builder for `EntityResponse`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `EntityResponse.Builder<T>` | `allow(HttpMethod... allowedMethods)` Set the set of allowed `HTTP methods`, as specified by the `Allow` header.
    `EntityResponse.Builder<T>` | `allow(Set<HttpMethod> allowedMethods)` Set the set of allowed `HTTP methods`, as specified by the `Allow` header.
    `reactor.core.publisher.Mono<EntityResponse<T>>` | `build()` Build the response.
    `EntityResponse.Builder<T>` | `cacheControl(CacheControl cacheControl)` Set the caching directives for the resource, as specified by the HTTP 1.1 `Cache-Control` header.
    `EntityResponse.Builder<T>` | `contentLength(long contentLength)` Set the length of the body in bytes, as specified by the `Content-Length` header.
    `EntityResponse.Builder<T>` | `contentType(MediaType contentType)` Set the media type of the body, as specified by the `Content-Type` header.
    `EntityResponse.Builder<T>` | `cookie(ResponseCookie cookie)` Add the given cookie to the response.
    `EntityResponse.Builder<T>` | `cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)` Manipulate this response's cookies with the given consumer.
    `EntityResponse.Builder<T>` | `eTag(String etag)` Set the entity tag of the body, as specified by the `ETag` header.
    `EntityResponse.Builder<T>` | `header(String headerName, String... headerValues)` Add the given header value(s) under the given name.
    `EntityResponse.Builder<T>` | `headers(HttpHeaders headers)` Copy the given headers into the entity's headers map.
    `EntityResponse.Builder<T>` | `hint(String key, Object value)` Add a serialization hint like `Jackson2CodecSupport.JSON_VIEW_HINT` to customize how the body will be serialized.
    `EntityResponse.Builder<T>` | `hints(Consumer<Map<String,Object>> hintsConsumer)` Customize the serialization hints with the given consumer.
    `EntityResponse.Builder<T>` | `lastModified(Instant lastModified)` Set the time the resource was last changed, as specified by the `Last-Modified` header.
    `EntityResponse.Builder<T>` | `lastModified(ZonedDateTime lastModified)` Set the time the resource was last changed, as specified by the `Last-Modified` header.
    `EntityResponse.Builder<T>` | `location(URI location)` Set the location of a resource, as specified by the `Location` header.
    `EntityResponse.Builder<T>` | `status(HttpStatus status)` Set the HTTP status.
    `EntityResponse.Builder<T>` | `status(int status)` Set the HTTP status.
    `EntityResponse.Builder<T>` | `varyBy(String... requestHeaders)` Configure one or more request header names (e.g.

- - ### Method Detail

    - #### header

          EntityResponse.Builder<T> header(String headerName,
                                           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

          EntityResponse.Builder<T> headers(HttpHeaders headers)

      Copy the given headers into the entity's headers map.
      Parameters:
        `headers` - the existing HttpHeaders to copy from
      Returns:
        this builder
      See Also:
        `HttpHeaders.add(String, String)`

    - #### status

          EntityResponse.Builder<T> status(HttpStatus status)

      Set the HTTP status.
      Parameters:
        `status` - the response status
      Returns:
        this builder

    - #### status

          EntityResponse.Builder<T> status(int status)

      Set the HTTP status.
      Parameters:
        `status` - the response status
      Returns:
        this builder
      Since:
        5.0.3

    - #### cookie

          EntityResponse.Builder<T> cookie(ResponseCookie cookie)

      Add the given cookie to the response.
      Parameters:
        `cookie` - the cookie to add
      Returns:
        this builder

    - #### cookies

          EntityResponse.Builder<T> cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)

      Manipulate this response's cookies with the given consumer. The cookies provided to the consumer are "live", so that the consumer can be used to overwrite existing cookies, remove cookies, or use any of the other `MultiValueMap` methods.
      Parameters:
        `cookiesConsumer` - a function that consumes the cookies
      Returns:
        this builder

    - #### allow

          EntityResponse.Builder<T> allow(HttpMethod... allowedMethods)

      Set the set of allowed `HTTP methods`, as specified by the `Allow` header.
      Parameters:
        `allowedMethods` - the allowed methods
      Returns:
        this builder
      See Also:
        `HttpHeaders.setAllow(Set)`

    - #### allow

          EntityResponse.Builder<T> allow(Set<HttpMethod> allowedMethods)

      Set the set of allowed `HTTP methods`, as specified by the `Allow` header.
      Parameters:
        `allowedMethods` - the allowed methods
      Returns:
        this builder
      See Also:
        `HttpHeaders.setAllow(Set)`

    - #### eTag

          EntityResponse.Builder<T> eTag(String etag)

      Set the entity tag of the body, as specified by the `ETag` header.
      Parameters:
        `etag` - the new entity tag
      Returns:
        this builder
      See Also:
        `HttpHeaders.setETag(String)`

    - #### lastModified

          EntityResponse.Builder<T> lastModified(ZonedDateTime lastModified)

      Set the time the resource was last changed, as specified by the `Last-Modified` header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

      Parameters:
        `lastModified` - the last modified date
      Returns:
        this builder
      See Also:
        `HttpHeaders.setLastModified(long)`

    - #### lastModified

          EntityResponse.Builder<T> lastModified(Instant lastModified)

      Set the time the resource was last changed, as specified by the `Last-Modified` header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

      Parameters:
        `lastModified` - the last modified date
      Returns:
        this builder
      Since:
        5.1.4
      See Also:
        `HttpHeaders.setLastModified(long)`

    - #### location

          EntityResponse.Builder<T> location(URI location)

      Set the location of a resource, as specified by the `Location` header.
      Parameters:
        `location` - the location
      Returns:
        this builder
      See Also:
        `HttpHeaders.setLocation(URI)`

    - #### cacheControl

          EntityResponse.Builder<T> cacheControl(CacheControl cacheControl)

      Set the caching directives for the resource, as specified by the HTTP 1.1 `Cache-Control` header.

      A `CacheControl` instance can be built like `CacheControl.maxAge(3600).cachePublic().noTransform()`.

      Parameters:
        `cacheControl` - a builder for cache-related HTTP response headers
      Returns:
        this builder
      See Also:
        RFC-7234 Section 5.2

    - #### varyBy

          EntityResponse.Builder<T> varyBy(String... requestHeaders)

      Configure one or more request header names (e.g. "Accept-Language") to add to the "Vary" response header to inform clients that the response is subject to content negotiation and variances based on the value of the given request headers. The configured request header names are added only if not already present in the response "Vary" header.
      Parameters:
        `requestHeaders` - request header names
      Returns:
        this builder

    - #### contentLength

          EntityResponse.Builder<T> contentLength(long contentLength)

      Set the length of the body in bytes, as specified by the `Content-Length` header.
      Parameters:
        `contentLength` - the content length
      Returns:
        this builder
      See Also:
        `HttpHeaders.setContentLength(long)`

    - #### contentType

          EntityResponse.Builder<T> contentType(MediaType contentType)

      Set the media type of the body, as specified by the `Content-Type` header.
      Parameters:
        `contentType` - the content type
      Returns:
        this builder
      See Also:
        `HttpHeaders.setContentType(MediaType)`

    - #### hint

          EntityResponse.Builder<T> hint(String key,
                                         Object value)

      Add a serialization hint like `Jackson2CodecSupport.JSON_VIEW_HINT` to customize how the body will be serialized.
      Parameters:
        `key` - the hint key
        `value` - the hint value

    - #### hints

          EntityResponse.Builder<T> hints(Consumer<Map<String,Object>> hintsConsumer)

      Customize the serialization hints with the given consumer.
      Parameters:
        `hintsConsumer` - a function that consumes the hints
      Returns:
        this builder
      Since:
        5.1.6

    - #### build

          reactor.core.publisher.Mono<EntityResponse<T>> build()

      Build the response.
      Returns:
        the built response