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(java.util.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(java.util.function.BiFunction<ServerWebExchange,ServerResponse.Context,reactor.core.publisher.Mono<java.lang.Void>> writeFunction)
Build the response entity with a custom writer function.
|
reactor.core.publisher.Mono<ServerResponse> |
build(org.reactivestreams.Publisher<java.lang.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(java.util.function.Consumer<MultiValueMap<java.lang.String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.
|
B |
eTag(java.lang.String eTag)
Set the entity tag of the body, as specified by the
ETag header. |
B |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header value(s) under the given name.
|
B |
headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate this response's headers with the given consumer.
|
B |
lastModified(java.time.ZonedDateTime lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
B |
location(java.net.URI location)
Set the location of a resource, as specified by the
Location header. |
B |
varyBy(java.lang.String... requestHeaders)
Configure one or more request header names (e.g.
|
B header(java.lang.String headerName, java.lang.String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
B headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
B cookie(ResponseCookie cookie)
cookie
- the cookie to addB cookies(java.util.function.Consumer<MultiValueMap<java.lang.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(java.util.Set<HttpMethod> allowedMethods)
HTTP methods
, as specified
by the Allow
header.allowedMethods
- the allowed methodsHttpHeaders.setAllow(Set)
B eTag(java.lang.String eTag)
ETag
header.eTag
- the new entity tagHttpHeaders.setETag(String)
B lastModified(java.time.ZonedDateTime lastModified)
Last-Modified
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
lastModified
- the last modified dateHttpHeaders.setLastModified(long)
B location(java.net.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(java.lang.String... requestHeaders)
requestHeaders
- request header namesreactor.core.publisher.Mono<ServerResponse> build()
reactor.core.publisher.Mono<ServerResponse> build(org.reactivestreams.Publisher<java.lang.Void> voidPublisher)
voidPublisher
completes.voidPublisher
- publisher publisher to indicate when the response should be committedreactor.core.publisher.Mono<ServerResponse> build(java.util.function.BiFunction<ServerWebExchange,ServerResponse.Context,reactor.core.publisher.Mono<java.lang.Void>> writeFunction)
writeFunction
- the function used to write to the ServerWebExchange