B
- the builder subclasspublic static interface ServerResponse.HeadersBuilder<B extends ServerResponse.HeadersBuilder<B>>
Modifier and Type | Method and Description |
---|---|
B |
allow(HttpMethod... allowedMethods)
Set the set of allowed
HTTP methods , as specified
by the Allow header. |
B |
allow(Set<HttpMethod> allowedMethods)
Set the set of allowed
HTTP methods , as specified
by the Allow header. |
reactor.core.publisher.Mono<ServerResponse> |
build()
Build the response entity with no body.
|
reactor.core.publisher.Mono<ServerResponse> |
build(BiFunction<ServerWebExchange,ServerResponse.Context,reactor.core.publisher.Mono<Void>> writeFunction)
Build the response entity with a custom writer function.
|
reactor.core.publisher.Mono<ServerResponse> |
build(org.reactivestreams.Publisher<Void> voidPublisher)
Build the response entity with no body.
|
B |
cacheControl(CacheControl cacheControl)
Set the caching directives for the resource, as specified by the HTTP 1.1
Cache-Control header. |
B |
cookie(ResponseCookie cookie)
Add the given cookie to the response.
|
B |
cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.
|
B |
eTag(String eTag)
Set the entity tag of the body, as specified by the
ETag header. |
B |
header(String headerName,
String... headerValues)
Add the given header value(s) under the given name.
|
B |
headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this response's headers with the given consumer.
|
B |
lastModified(Instant lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
B |
lastModified(ZonedDateTime lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
B |
location(URI location)
Set the location of a resource, as specified by the
Location header. |
B |
varyBy(String... requestHeaders)
Configure one or more request header names (e.g.
|
B header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
B headers(Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
B cookie(ResponseCookie cookie)
cookie
- the cookie to addB cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
MultiValueMap
methods.cookiesConsumer
- a function that consumes the cookiesB allow(HttpMethod... allowedMethods)
HTTP methods
, as specified
by the Allow
header.allowedMethods
- the allowed methodsHttpHeaders.setAllow(Set)
B allow(Set<HttpMethod> allowedMethods)
HTTP methods
, as specified
by the Allow
header.allowedMethods
- the allowed methodsHttpHeaders.setAllow(Set)
B eTag(String eTag)
ETag
header.eTag
- the new entity tagHttpHeaders.setETag(String)
B lastModified(ZonedDateTime lastModified)
Last-Modified
header.lastModified
- the last modified dateHttpHeaders.setLastModified(long)
B lastModified(Instant lastModified)
Last-Modified
header.lastModified
- the last modified dateHttpHeaders.setLastModified(long)
B location(URI location)
Location
header.location
- the locationHttpHeaders.setLocation(URI)
B cacheControl(CacheControl cacheControl)
Cache-Control
header.
A CacheControl
instance can be built like
CacheControl.maxAge(3600).cachePublic().noTransform()
.
cacheControl
- a builder for cache-related HTTP response headersB varyBy(String... requestHeaders)
requestHeaders
- request header namesreactor.core.publisher.Mono<ServerResponse> build()
reactor.core.publisher.Mono<ServerResponse> build(org.reactivestreams.Publisher<Void> voidPublisher)
voidPublisher
completes.voidPublisher
- publisher publisher to indicate when the response should be committedreactor.core.publisher.Mono<ServerResponse> build(BiFunction<ServerWebExchange,ServerResponse.Context,reactor.core.publisher.Mono<Void>> writeFunction)
writeFunction
- the function used to write to the ServerWebExchange