Package org.springframework.http
Interface ResponseEntity.BodyBuilder
- All Superinterfaces:
ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>
- Enclosing class:
- ResponseEntity<T>
public static interface ResponseEntity.BodyBuilder extends ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>
Defines a builder that adds a body to the response entity.- Since:
- 4.1
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> ResponseEntity<T>
body(T body)
Set the body of the response entity and returns it.ResponseEntity.BodyBuilder
contentLength(long contentLength)
Set the length of the body in bytes, as specified by theContent-Length
header.ResponseEntity.BodyBuilder
contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.Methods inherited from interface org.springframework.http.ResponseEntity.HeadersBuilder
allow, build, cacheControl, eTag, header, headers, lastModified, location, varyBy
Method Detail
contentLength
ResponseEntity.BodyBuilder contentLength(long contentLength)
Set the length of the body in bytes, as specified by theContent-Length
header.- Parameters:
contentLength
- the content length- Returns:
- this builder
- See Also:
HttpHeaders.setContentLength(long)
contentType
ResponseEntity.BodyBuilder contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.- Parameters:
contentType
- the content type- Returns:
- this builder
- See Also:
HttpHeaders.setContentType(MediaType)
body
<T> ResponseEntity<T> body(T body)
Set the body of the response entity and returns it.- Type Parameters:
T
- the type of the body- Parameters:
body
- the body of the response entity- Returns:
- the built response entity