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.
- Since:
- 6.1
- Author:
- Arjen Poutsma, Sebastien Deleuze
- 
Nested Class SummaryNested classes/interfaces inherited from interface RestClient.RequestHeadersSpecRestClient.RequestHeadersSpec.ConvertibleClientHttpResponse, RestClient.RequestHeadersSpec.ExchangeFunction<T>, RestClient.RequestHeadersSpec.RequiredValueExchangeFunction<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.Set the hint with the given name to the given value forSmartHttpMessageConverters supporting them.Methods inherited from interface RestClient.RequestHeadersSpecaccept, acceptCharset, apiVersion, attribute, attributes, cookie, cookies, exchange, exchange, exchangeForRequiredValue, exchangeForRequiredValue, 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
 
- 
hintSet the hint with the given name to the given value forSmartHttpMessageConverters supporting them.- Parameters:
- key- the key of the hint to add
- value- the value of the hint to add
- Returns:
- this builder
- Since:
- 7.0
 
 
-