接口 ResponseEntity.BodyBuilder
- 封闭类:
- ResponseEntity<T>
public static interface ResponseEntity.BodyBuilder extends ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>
Defines a builder that adds a body to the response entity.- 从以下版本开始:
- 4.1
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 <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.从接口继承的方法 org.springframework.http.ResponseEntity.HeadersBuilder
allow, build, cacheControl, eTag, header, headers, headers, lastModified, lastModified, lastModified, location, varyBy
方法详细资料
contentLength
ResponseEntity.BodyBuilder contentLength(long contentLength)
Set the length of the body in bytes, as specified by theContent-Length
header.- 参数:
contentLength
- the content length- 返回:
- this builder
- 另请参阅:
HttpHeaders.setContentLength(long)
contentType
ResponseEntity.BodyBuilder contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.- 参数:
contentType
- the content type- 返回:
- this builder
- 另请参阅:
HttpHeaders.setContentType(MediaType)
body
<T> ResponseEntity<T> body(@Nullable T body)
Set the body of the response entity and returns it.- 类型参数:
T
- the type of the body- 参数:
body
- the body of the response entity- 返回:
- the built response entity