Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.function.server

pack-priv Class DefaultServerResponseBuilder

extends Object
implements BodyBuilder
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder, org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder
Imports
java.net.URI, java.time.Instant, .ZonedDateTime, java.util.Arrays, .Collections, .HashMap, .LinkedHashSet, .List, .Map, .Optional, .Set, java.util.function.BiFunction, .Consumer, .Function, org.reactivestreams.Publisher, reactor.core.publisher.Mono, org.springframework.core.ParameterizedTypeReference, org.springframework.core.codec.Hints, org.springframework.http.CacheControl, .HttpHeaders, .HttpMethod, .HttpStatusCode, .MediaType, .ReactiveHttpOutputMessage, .ResponseCookie, org.springframework.http.codec.HttpMessageWriter, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpResponse, org.springframework.util.Assert, .CollectionUtils, .LinkedMultiValueMap, .MultiValueMap, org.springframework.web.reactive.function.BodyInserter, .BodyInserters, org.springframework.web.server.ServerWebExchange

Default ServerResponse.BodyBuilder implementation.
Authors
Arjen Poutsma, Juergen Hoeller, Sebastien Deleuze
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final MultiValueMap<String, ResponseCookie>
private final HttpHeaders
private final Map<String, Object>
private final HttpStatusCode

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public ServerResponse.BodyBuilder
allow(HttpMethod...
the allowed methods
allowedMethods
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.allow.

Set the set of allowed HTTP methods, as specified by the Allow header.

public ServerResponse.BodyBuilder
allow(Set<HttpMethod>
the allowed methods
allowedMethods
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.allow.

Set the set of allowed HTTP methods, as specified by the Allow header.

public <T, P extends Publisher<T>> Mono<ServerResponse>
body(P
the Publisher to write to the response
publisher
,
Class<T>
the type of elements published
elementClass
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body.

Set the body from the given Publisher.

public <T, P extends Publisher<T>> Mono<ServerResponse>
body(P
the Publisher to use to write the response
publisher
,
ParameterizedTypeReference<T>
the type of elements produced
typeRef
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body.

Variant of body(Publisher, Class) that allows using any producer that can be resolved to Publisher via ReactiveAdapterRegistry.

public Mono<ServerResponse>
body(Object
the producer to write to the request
producer
,
Class<?>
the type of elements produced
elementClass
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body, org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body.

Variant of body(Publisher, Class) that allows using any producer that can be resolved to Publisher via ReactiveAdapterRegistry.

public Mono<ServerResponse>
body(Object
the producer to write to the response
producer
,
ParameterizedTypeReference<?>
the type of elements produced
elementTypeRef
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body, org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body.

Variant of body(Publisher, ParameterizedTypeReference) that allows using any producer that can be resolved to Publisher via ReactiveAdapterRegistry.

public Mono<ServerResponse>
body(BodyInserter<?, ? super ServerHttpResponse>
the BodyInserter that writes to the response
inserter
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.body.

Set the body of the response to the given BodyInserter and return it.

public Mono<ServerResponse>
bodyValue(Object
the body of the response
body
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.bodyValue.

Set the body of the response to the given Object and return it.

public Mono<ServerResponse>
public Mono<ServerResponse>
build(Publisher<Void>
the publisher to indicate when the response should be committed
voidPublisher
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.build.

Build the response entity with no body.

public Mono<ServerResponse>
build(BiFunction<ServerWebExchange, ServerResponse.Context, Mono<Void>>
the function used to write to the ServerWebExchange
writeFunction
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.build.

Build the response entity with a custom writer function.

public ServerResponse.BodyBuilder
cacheControl(CacheControl
a builder for cache-related HTTP response headers
cacheControl
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.cacheControl.

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

public ServerResponse.BodyBuilder
contentLength(long
the content length
contentLength
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.contentLength.

Set the length of the body in bytes, as specified by the Content-Length header.

public ServerResponse.BodyBuilder
contentType(MediaType
the content type
contentType
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.contentType.

Set the media type of the body, as specified by the Content-Type header.

public ServerResponse.BodyBuilder
cookies(Consumer<MultiValueMap<String, ResponseCookie>>
a function that consumes the cookies
cookiesConsumer
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.cookies.

Manipulate this response's cookies with the given consumer.

public ServerResponse.BodyBuilder
eTag(String
the new entity tag
etag
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.eTag.

Set the entity tag of the body, as specified by the ETag header.

public ServerResponse.BodyBuilder
header(String
the header name
headerName
,
String...
the header value(s)
headerValues
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.header.

Add the given header value(s) under the given name.

public ServerResponse.BodyBuilder
headers(Consumer<HttpHeaders>
a function that consumes the HttpHeaders
headersConsumer
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.headers.

Manipulate this response's headers with the given consumer.

public ServerResponse.BodyBuilder
hint(String
the hint key
key
,
Object
the hint value
value
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.hint.

Add a serialization hint like Jackson2CodecSupport#JSON_VIEW_HINT to customize how the body will be serialized.

public ServerResponse.BodyBuilder
hints(Consumer<Map<String, Object>>
a function that consumes the hints
hintsConsumer
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.hints.

Customize the serialization hints with the given consumer.

private <T> Mono<ServerResponse>
public ServerResponse.BodyBuilder
lastModified(ZonedDateTime
the last modified date
lastModified
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.lastModified.

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

public ServerResponse.BodyBuilder
lastModified(Instant
the last modified date
lastModified
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.lastModified.

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

public ServerResponse.BodyBuilder
location(URI
the location
location
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.location.

Set the location of a resource, as specified by the Location header.

public Mono<ServerResponse>
render(String
the name of the template to be rendered
name
,
Object...
the modelAttributes used to render the template
modelAttributes
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.render.

Render the template with the given name using the given modelAttributes.

public Mono<ServerResponse>
render(String
the name of the template to be rendered
name
,
Map<String, ?>
the model used to render the template
model
)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.render.

Render the template with the given name using the given model.

public Mono<ServerResponse>
syncBody(Object body)

Implements org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder.syncBody.

Deprecated

Set the response body to the given Object and return it.

public ServerResponse.BodyBuilder
varyBy(String...
request header names
requestHeaders
)

Implements org.springframework.web.reactive.function.server.ServerResponse.HeadersBuilder.varyBy.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait