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. |
ServerResponse |
build()
Build the response entity with no body.
|
ServerResponse |
build(java.util.function.BiFunction<HttpServletRequest,HttpServletResponse,ModelAndView> writeFunction)
Build the response entity with a custom write function.
|
B |
cacheControl(CacheControl cacheControl)
Set the caching directives for the resource, as specified by the HTTP 1.1
Cache-Control header. |
B |
cookie(Cookie cookie)
Add the given cookie to the response.
|
B |
cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,Cookie>> 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.Instant lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
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(Cookie cookie)
cookie
- the cookie to addB cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,Cookie>> 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.lastModified
- the last modified dateHttpHeaders.setLastModified(long)
B lastModified(java.time.Instant lastModified)
Last-Modified
header.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 namesServerResponse build()
ServerResponse build(java.util.function.BiFunction<HttpServletRequest,HttpServletResponse,ModelAndView> writeFunction)
writeFunction
- the function used to write to the HttpServletResponse