private static class ResponseEntity.DefaultBuilder extends java.lang.Object implements ResponseEntity.BodyBuilder
| Modifier and Type | Field and Description |
|---|---|
private HttpHeaders |
headers |
private HttpStatus |
status |
| Constructor and Description |
|---|
DefaultBuilder(HttpStatus status) |
| Modifier and Type | Method and Description |
|---|---|
ResponseEntity.BodyBuilder |
allow(HttpMethod... allowedMethods)
Set the set of allowed
HTTP methods, as specified
by the Allow header. |
<T> ResponseEntity<T> |
body(T body)
Sets the body of the response entity and returns it.
|
ResponseEntity<java.lang.Void> |
build()
Builds the response entity with no body.
|
ResponseEntity.BodyBuilder |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
ResponseEntity.BodyBuilder |
contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
ResponseEntity.BodyBuilder |
eTag(java.lang.String eTag)
Sets the entity tag of the body, as specified by the
ETag header. |
ResponseEntity.BodyBuilder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
ResponseEntity.BodyBuilder |
lastModified(long date)
Sets the time the resource was last changed, as specified by the
Last-Modified header. |
ResponseEntity.BodyBuilder |
location(java.net.URI location)
Set the location of a resource, as specified by the
Location header. |
private final HttpStatus status
private final HttpHeaders headers
public DefaultBuilder(HttpStatus status)
public ResponseEntity.BodyBuilder header(java.lang.String headerName, java.lang.String... headerValues)
ResponseEntity.HeadersBuilderheader in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>headerName - the header nameheaderValues - the header value(s)HttpHeaders.add(String, String)public ResponseEntity.BodyBuilder allow(HttpMethod... allowedMethods)
ResponseEntity.HeadersBuilderHTTP methods, as specified
by the Allow header.allow in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>allowedMethods - the allowed methodsHttpHeaders.setAllow(Set)public ResponseEntity.BodyBuilder contentLength(long contentLength)
ResponseEntity.BodyBuilderContent-Length header.contentLength in interface ResponseEntity.BodyBuildercontentLength - the content lengthHttpHeaders.setContentLength(long)public ResponseEntity.BodyBuilder contentType(MediaType contentType)
ResponseEntity.BodyBuilderContent-Type header.contentType in interface ResponseEntity.BodyBuildercontentType - the content typeHttpHeaders.setContentType(MediaType)public ResponseEntity.BodyBuilder eTag(java.lang.String eTag)
ResponseEntity.HeadersBuilderETag header.eTag in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>eTag - the new entity tagHttpHeaders.setETag(String)public ResponseEntity.BodyBuilder lastModified(long date)
ResponseEntity.HeadersBuilderLast-Modified header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
lastModified in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>date - the last modified dateHttpHeaders.setLastModified(long)public ResponseEntity.BodyBuilder location(java.net.URI location)
ResponseEntity.HeadersBuilderLocation header.location in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>location - the locationHttpHeaders.setLocation(URI)public ResponseEntity<java.lang.Void> build()
ResponseEntity.HeadersBuilderbuild in interface ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>ResponseEntity.BodyBuilder.body(Object)public <T> ResponseEntity<T> body(T body)
ResponseEntity.BodyBuilderbody in interface ResponseEntity.BodyBuilderT - the type of the bodybody - the body of the response entity