B
- the builder subclasspublic static interface ResponseEntity.HeadersBuilder<B extends ResponseEntity.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. |
<T> ResponseEntity<T> |
build()
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 |
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, single header value under the given name.
|
B |
headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this entity's headers with the given consumer.
|
B |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
B |
lastModified(Instant lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
B |
lastModified(long 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(@Nullable HttpHeaders headers)
headers
- the existing HttpHeaders to copy fromHttpHeaders.add(String, String)
B headers(Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
B allow(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(ZonedDateTime)
B lastModified(Instant lastModified)
Last-Modified
header.lastModified
- the last modified dateHttpHeaders.setLastModified(Instant)
B lastModified(long 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(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 names<T> ResponseEntity<T> build()
ResponseEntity.BodyBuilder.body(Object)