Package org.springframework.http

# Interface RequestEntity.BodyBuilder

All Superinterfaces:
  `RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>`

Enclosing class:
  RequestEntity<T>

public static interface RequestEntity.BodyBuilder extends RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
Defines a builder that adds a body to the response entity.

## Method Summary

Modifier and Type
Method
Description
`<T> RequestEntity<T>`
`body(T body)`
Set the body of the request entity and build the RequestEntity.
`<T> RequestEntity<T>`
`body(T body, Type type)`
Set the body and type of the request entity and build the RequestEntity.
`RequestEntity.BodyBuilder`
`contentLength(long contentLength)`
Set the length of the body in bytes, as specified by the `Content-Length` header.
`RequestEntity.BodyBuilder`
`contentType(MediaType contentType)`
Set the media type of the body, as specified by the `Content-Type` header.

### Methods inherited from interface org.springframework.http.RequestEntity.HeadersBuilder

`accept, acceptCharset, build, header, headers, headers, ifModifiedSince, ifModifiedSince, ifModifiedSince, ifNoneMatch`

## Method Details

### contentLength

RequestEntity.BodyBuilder contentLength(long contentLength)
Set the length of the body in bytes, as specified by the `Content-Length` header.

Parameters:
  `contentLength` - the content length
Returns:
  this builder
See Also:
  - `HttpHeaders.setContentLength(long)`

### contentType

RequestEntity.BodyBuilder contentType(MediaType contentType)
Set the media type of the body, as specified by the `Content-Type` header.

Parameters:
  `contentType` - the content type
Returns:
  this builder
See Also:
  - `HttpHeaders.setContentType(MediaType)`

### body

<T> RequestEntity<T> body(T body)
Set the body of the request entity and build the RequestEntity.

Type Parameters:
  `T` - the type of the body
Parameters:
  `body` - the body of the request entity
Returns:
  the built request entity

### body

<T> RequestEntity<T> body(T body, Type type)
Set the body and type of the request entity and build the RequestEntity.

Type Parameters:
  `T` - the type of the body
Parameters:
  `body` - the body of the request entity
  `type` - the type of the body, useful for generic type resolution
Returns:
  the built request entity
Since:
  4.3