Package org.springframework.web.servlet.function

# Interface RenderingResponse.Builder

Enclosing interface:
  RenderingResponse

public static interface RenderingResponse.Builder
Defines a builder for `RenderingResponse`.

## Method Summary

Modifier and Type
Method
Description
`RenderingResponse`
`build()`
Build the response.
`RenderingResponse.Builder`
`cookie(Cookie cookie)`
Add the given cookie to the response.
`RenderingResponse.Builder`
`cookies(Consumer<org.springframework.util.MultiValueMap<String,Cookie>> cookiesConsumer)`
Manipulate this response's cookies with the given consumer.
`RenderingResponse.Builder`
`header(String headerName, String... headerValues)`
Add the given header value(s) under the given name.
`RenderingResponse.Builder`
`headers(Consumer<org.springframework.http.HttpHeaders> headersConsumer)`
Manipulate this response's headers with the given consumer.
`RenderingResponse.Builder`
`modelAttribute(Object attribute)`
Add the supplied attribute to the model using a generated name.
`RenderingResponse.Builder`
`modelAttribute(String name, Object value)`
Add the supplied attribute value under the supplied name.
`RenderingResponse.Builder`
`modelAttributes(Object... attributes)`
Copy all attributes in the supplied array into the model, using attribute name generation for each element.
`RenderingResponse.Builder`
`modelAttributes(Collection<?> attributes)`
Copy all attributes in the supplied `Collection` into the model, using attribute name generation for each element.
`RenderingResponse.Builder`
`modelAttributes(Map<String,?> attributes)`
Copy all attributes in the supplied `Map` into the model.
`RenderingResponse.Builder`
`status(int status)`
Set the HTTP status.
`RenderingResponse.Builder`
`status(org.springframework.http.HttpStatusCode status)`
Set the HTTP status.

## Method Details

### modelAttribute

RenderingResponse.Builder modelAttribute(Object attribute)
Add the supplied attribute to the model using a generated name.

Note: Empty `Collections` are not added to the model when using this method because we cannot correctly determine the true convention name. View code should check for `null` rather than for empty collections.

Parameters:
  `attribute` - the model attribute value (never `null`)

### modelAttribute

RenderingResponse.Builder modelAttribute(String name, @Nullable Object value)
Add the supplied attribute value under the supplied name.

Parameters:
  `name` - the name of the model attribute (never `null`)
  `value` - the model attribute value (can be `null`)

### modelAttributes

RenderingResponse.Builder modelAttributes(Object... attributes)
Copy all attributes in the supplied array into the model, using attribute name generation for each element.

See Also:
  - `modelAttribute(Object)`

### modelAttributes

RenderingResponse.Builder modelAttributes(Collection<?> attributes)
Copy all attributes in the supplied `Collection` into the model, using attribute name generation for each element.

See Also:
  - `modelAttribute(Object)`

### modelAttributes

RenderingResponse.Builder modelAttributes(Map<String,?> attributes)
Copy all attributes in the supplied `Map` into the model.

See Also:
  - `modelAttribute(String, Object)`

### header

RenderingResponse.Builder 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

RenderingResponse.Builder headers(Consumer<org.springframework.http.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

### status

RenderingResponse.Builder status(org.springframework.http.HttpStatusCode status)
Set the HTTP status.

Parameters:
  `status` - the response status
Returns:
  this builder

### status

RenderingResponse.Builder status(int status)
Set the HTTP status.

Parameters:
  `status` - the response status
Returns:
  this builder

### cookie

RenderingResponse.Builder cookie(Cookie cookie)
Add the given cookie to the response.

Parameters:
  `cookie` - the cookie to add
Returns:
  this builder

### cookies

RenderingResponse.Builder cookies(Consumer<org.springframework.util.MultiValueMap<String,Cookie>> 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

### build

RenderingResponse build()
Build the response.

Returns:
  the built response