public static interface WebClient.RequestBodySpec extends WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
accept, acceptCharset, attribute, attributes, cookie, cookies, exchange, header, headers, ifModifiedSince, ifNoneMatch, retrieve
WebClient.RequestBodySpec contentLength(long contentLength)
Content-Length
ヘッダーで指定されているように、本文の長さをバイト単位で設定します。contentLength
- コンテンツの長さ HttpHeaders.setContentLength(long)
WebClient.RequestBodySpec contentType(MediaType contentType)
Content-Type
ヘッダーで指定されているように、本文のメディア型を設定します。contentType
- コンテンツ型 HttpHeaders.setContentType(MediaType)
WebClient.RequestHeadersSpec<?> bodyValue(ObjectSE body)
body(BodyInserter)
のショートカット。例:Person person = ... ; Mono<Void> result = client.post() .uri("/persons/{id}", id) .contentType(MediaType.APPLICATION_JSON) .bodyValue(person) .retrieve() .bodyToMono(Void.class);
マルチパートリクエストの場合、MultipartBodyBuilder
で準備された MultiValueMap
を提供することを検討してください。
body
- リクエストボディに書き込む値 IllegalArgumentExceptionSE
- body
が Publisher
または ReactiveAdapterRegistry
で既知のプロデューサーの場合 <T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, ClassSE<T> elementClass)
body(BodyInserter)
のショートカット。例:Mono<Person> personMono = ... ; Mono<Void> result = client.post() .uri("/persons/{id}", id) .contentType(MediaType.APPLICATION_JSON) .body(personMono, Person.class) .retrieve() .bodyToMono(Void.class);
T
- パブリッシャーに含まれる要素の型 P
- Publisher
の型 publisher
- リクエストに書き込む Publisher
elementClass
- 公開された要素の型 <T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, ParameterizedTypeReference<T> elementTypeRef)
body(Publisher, Class)
のバリアント。T
- パブリッシャーに含まれる要素の型 P
- Publisher
の型 publisher
- リクエストに書き込む Publisher
elementTypeRef
- 公開された要素の型 WebClient.RequestHeadersSpec<?> body(ObjectSE producer, ClassSE<?> elementClass)
producer
- リクエストに書き込むプロデューサー elementClass
- 生成される要素の型 WebClient.RequestHeadersSpec<?> body(ObjectSE producer, ParameterizedTypeReference<?> elementTypeRef)
ReactiveAdapterRegistry
を介して Publisher
に解決できる任意のプロデューサーを使用できる body(Publisher, ParameterizedTypeReference)
のバリアント。producer
- リクエストに書き込むプロデューサー elementTypeRef
- 生成される要素の型 WebClient.RequestHeadersSpec<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserter
実装については、BodyInserters
を参照してください。inserter
- リクエスト本文に使用する本文挿入子 BodyInserters
@DeprecatedSE WebClient.RequestHeadersSpec<?> syncBody(ObjectSE body)
bodyValue(Object)
に 置き換えられました。