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(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, single header value under the given name.
|
B |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
B |
lastModified(long 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(@Nullable HttpHeaders headers)
headers
- the existing HttpHeaders to copy fromHttpHeaders.add(String, String)
B allow(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(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(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 names<T> ResponseEntity<T> build()
ResponseEntity.BodyBuilder.body(Object)