public static interface RenderingResponse.Builder
RenderingResponse
.Modifier and Type | Method and Description |
---|---|
RenderingResponse |
build()
Build the response.
|
RenderingResponse.Builder |
cookie(Cookie cookie)
Add the given cookie to the response.
|
RenderingResponse.Builder |
cookies(Consumer<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<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(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 |
modelAttributes(Object... attributes)
Copy all attributes in the supplied array into the model,
using attribute name generation for each element.
|
RenderingResponse.Builder |
status(HttpStatus status)
Set the HTTP status.
|
RenderingResponse.Builder |
status(int status)
Set the HTTP status.
|
RenderingResponse.Builder modelAttribute(Object attribute)
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.
attribute
- the model attribute value (never null
)RenderingResponse.Builder modelAttribute(String name, @Nullable Object value)
name
- the name of the model attribute (never null
)value
- the model attribute value (can be null
)RenderingResponse.Builder modelAttributes(Object... attributes)
modelAttribute(Object)
RenderingResponse.Builder modelAttributes(Collection<?> attributes)
Collection
into the model,
using attribute name generation for each element.modelAttribute(Object)
RenderingResponse.Builder modelAttributes(Map<String,?> attributes)
Map
into the model.modelAttribute(String, Object)
RenderingResponse.Builder header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
RenderingResponse.Builder headers(Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
RenderingResponse.Builder status(HttpStatus status)
status
- the response statusRenderingResponse.Builder status(int status)
status
- the response statusRenderingResponse.Builder cookie(Cookie cookie)
cookie
- the cookie to addRenderingResponse.Builder cookies(Consumer<MultiValueMap<String,Cookie>> cookiesConsumer)
MultiValueMap
methods.cookiesConsumer
- a function that consumes the cookiesRenderingResponse build()