T
- a self reference to the builder typepublic static interface EntityResponse.Builder<T>
EntityResponse
.Modifier and Type | Method and Description |
---|---|
EntityResponse.Builder<T> |
allow(HttpMethod... allowedMethods)
Set the set of allowed
HTTP methods , as specified
by the Allow header. |
EntityResponse.Builder<T> |
allow(Set<HttpMethod> allowedMethods)
Set the set of allowed
HTTP methods , as specified
by the Allow header. |
reactor.core.publisher.Mono<EntityResponse<T>> |
build()
Build the response.
|
EntityResponse.Builder<T> |
cacheControl(CacheControl cacheControl)
Set the caching directives for the resource, as specified by the HTTP 1.1
Cache-Control header. |
EntityResponse.Builder<T> |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
EntityResponse.Builder<T> |
contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
EntityResponse.Builder<T> |
cookie(ResponseCookie cookie)
Add the given cookie to the response.
|
EntityResponse.Builder<T> |
cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.
|
EntityResponse.Builder<T> |
eTag(String etag)
Set the entity tag of the body, as specified by the
ETag header. |
EntityResponse.Builder<T> |
header(String headerName,
String... headerValues)
Add the given header value(s) under the given name.
|
EntityResponse.Builder<T> |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
EntityResponse.Builder<T> |
hint(String key,
Object value)
Add a serialization hint like
Jackson2CodecSupport.JSON_VIEW_HINT to
customize how the body will be serialized. |
EntityResponse.Builder<T> |
hints(Consumer<Map<String,Object>> hintsConsumer)
Customize the serialization hints with the given consumer.
|
EntityResponse.Builder<T> |
lastModified(Instant lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
EntityResponse.Builder<T> |
lastModified(ZonedDateTime lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
EntityResponse.Builder<T> |
location(URI location)
Set the location of a resource, as specified by the
Location header. |
EntityResponse.Builder<T> |
status(HttpStatus status)
Set the HTTP status.
|
EntityResponse.Builder<T> |
status(int status)
Set the HTTP status.
|
EntityResponse.Builder<T> |
varyBy(String... requestHeaders)
Configure one or more request header names (e.g.
|
EntityResponse.Builder<T> header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
EntityResponse.Builder<T> headers(HttpHeaders headers)
headers
- the existing HttpHeaders to copy fromHttpHeaders.add(String, String)
EntityResponse.Builder<T> status(HttpStatus status)
status
- the response statusEntityResponse.Builder<T> status(int status)
status
- the response statusEntityResponse.Builder<T> cookie(ResponseCookie cookie)
cookie
- the cookie to addEntityResponse.Builder<T> cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
MultiValueMap
methods.cookiesConsumer
- a function that consumes the cookiesEntityResponse.Builder<T> allow(HttpMethod... allowedMethods)
HTTP methods
, as specified
by the Allow
header.allowedMethods
- the allowed methodsHttpHeaders.setAllow(Set)
EntityResponse.Builder<T> allow(Set<HttpMethod> allowedMethods)
HTTP methods
, as specified
by the Allow
header.allowedMethods
- the allowed methodsHttpHeaders.setAllow(Set)
EntityResponse.Builder<T> eTag(String etag)
ETag
header.etag
- the new entity tagHttpHeaders.setETag(String)
EntityResponse.Builder<T> lastModified(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)
EntityResponse.Builder<T> lastModified(Instant 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)
EntityResponse.Builder<T> location(URI location)
Location
header.location
- the locationHttpHeaders.setLocation(URI)
EntityResponse.Builder<T> 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 headersEntityResponse.Builder<T> varyBy(String... requestHeaders)
requestHeaders
- request header namesEntityResponse.Builder<T> contentLength(long contentLength)
Content-Length
header.contentLength
- the content lengthHttpHeaders.setContentLength(long)
EntityResponse.Builder<T> contentType(MediaType contentType)
Content-Type
header.contentType
- the content typeHttpHeaders.setContentType(MediaType)
EntityResponse.Builder<T> hint(String key, Object value)
Jackson2CodecSupport.JSON_VIEW_HINT
to
customize how the body will be serialized.key
- the hint keyvalue
- the hint valueEntityResponse.Builder<T> hints(Consumer<Map<String,Object>> hintsConsumer)
hintsConsumer
- a function that consumes the hintsreactor.core.publisher.Mono<EntityResponse<T>> build()