Package org.springframework.web.client
Interface RestClient.RequestBodySpec
- All Superinterfaces:
- RestClient.RequestHeadersSpec<RestClient.RequestBodySpec>
- All Known Subinterfaces:
- RestClient.RequestBodyUriSpec
- Enclosing interface:
- RestClient
public static interface RestClient.RequestBodySpec
extends RestClient.RequestHeadersSpec<RestClient.RequestBodySpec>
Contract for specifying request headers and body leading up to the exchange.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.web.client.RestClient.RequestHeadersSpecRestClient.RequestHeadersSpec.ConvertibleClientHttpResponse, RestClient.RequestHeadersSpec.ExchangeFunction<T>
- 
Method SummaryModifier and TypeMethodDescriptionSet the body of the request to the givenObject.Set the body of the request to the given function that writes to anOutputStream.body(T body, ParameterizedTypeReference<T> bodyType) Set the body of the request to the givenObject.contentLength(long contentLength) Set the length of the body in bytes, as specified by theContent-Lengthheader.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.Methods inherited from interface org.springframework.web.client.RestClient.RequestHeadersSpecaccept, acceptCharset, exchange, exchange, header, headers, httpRequest, ifModifiedSince, ifNoneMatch, retrieve
- 
Method Details- 
contentLengthSet the length of the body in bytes, as specified by theContent-Lengthheader.- Parameters:
- contentLength- the content length
- Returns:
- this builder
- See Also:
 
- 
contentTypeSet the media type of the body, as specified by theContent-Typeheader.- Parameters:
- contentType- the content type
- Returns:
- this builder
- See Also:
 
- 
bodySet the body of the request to the givenObject. For example:Person person = ... ; ResponseEntity<Void> response = client.post() .uri("/persons/{id}", id) .contentType(MediaType.APPLICATION_JSON) .body(person) .retrieve() .toBodilessEntity();- Parameters:
- body- the body of the request
- Returns:
- this builder
 
- 
bodySet the body of the request to the givenObject. The parameterbodyTypeis used to capture the generic type.- Parameters:
- body- the body of the request
- bodyType- the type of the body, used to capture the generic type
- Returns:
- this builder
 
- 
bodySet the body of the request to the given function that writes to anOutputStream.- Parameters:
- body- a function that takes an- OutputStreamand can throw an- IOException
- Returns:
- this builder
 
 
-