public static interface Response.BodyBuilder extends Response.HeadersBuilder<Response.BodyBuilder>
Modifier and Type | Method and Description |
---|---|
<T> Response<T> |
body(BiFunction<org.springframework.http.server.reactive.ServerHttpResponse,StrategiesSupplier,reactor.core.publisher.Mono<Void>> writer,
Supplier<T> supplier)
Set the body with the given
supplier function, and write it with the given
writer function. |
<T> Response<T> |
body(BodyInserter<T> inserter)
Set the body of the response to the given
BodyInserter and return it. |
Response.BodyBuilder |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
Response.BodyBuilder |
contentType(org.springframework.http.MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
Response<Rendering> |
render(String name,
Map<String,?> model)
Render the template with the given
name using the given model . |
Response<Rendering> |
render(String name,
Object... modelAttributes)
Render the template with the given
name using the given modelAttributes . |
allow, build, build, cacheControl, eTag, header, headers, lastModified, location, varyBy
Response.BodyBuilder contentLength(long contentLength)
Content-Length
header.contentLength
- the content lengthHttpHeaders.setContentLength(long)
Response.BodyBuilder contentType(org.springframework.http.MediaType contentType)
Content-Type
header.contentType
- the content typeHttpHeaders.setContentType(MediaType)
<T> Response<T> body(BiFunction<org.springframework.http.server.reactive.ServerHttpResponse,StrategiesSupplier,reactor.core.publisher.Mono<Void>> writer, Supplier<T> supplier)
supplier
function, and write it with the given
writer
function.T
- the type contained in the bodywriter
- a function that writes the body to the ServerHttpResponse
supplier
- a function that returns the body instance<T> Response<T> body(BodyInserter<T> inserter)
BodyInserter
and return it.T
- the type contained in the bodyinserter
- the BodyInserter
that writes to the responseResponse<Rendering> render(String name, Object... modelAttributes)
name
using the given modelAttributes
.
The model attributes are mapped under a
generated name.
Collections
are not added to
the model when using this method because we cannot correctly determine
the true convention name.
name
- the name of the template to be renderedmodelAttributes
- the modelAttributes used to render the template