public static interface WebClient.RequestBodySpec extends WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
修飾子と型 | メソッドと説明 |
---|---|
WebClient.RequestHeadersSpec<?> | body(BodyInserter<?,? super ClientHttpRequest> inserter) 指定された本文挿入子を使用して、リクエストの本文を設定します。 |
<T,P extends org.reactivestreams.Publisher<T>> | body(P publisher, ClassSE<T> elementClass) パブリッシャーインサーターを使用した body(BodyInserter) のショートカット。 |
<T,P extends org.reactivestreams.Publisher<T>> | body(P publisher, ParameterizedTypeReference<T> typeReference) ParameterizedTypeReference を介してジェネリクスを含む要素型情報を提供できる body(Publisher, Class) のバリアント。 |
WebClient.RequestBodySpec | contentLength(long contentLength) Content-Length ヘッダーで指定されているように、本文の長さをバイト単位で設定します。 |
WebClient.RequestBodySpec | contentType(MediaType contentType) Content-Type ヘッダーで指定されているように、本文のメディア型を設定します。 |
WebClient.RequestHeadersSpec<?> | syncBody(ObjectSE body) オブジェクトインサーターを使用した body(BodyInserter) のショートカット。 |
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<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserters
は、BodyInserter
の組み込み実装へのアクセスを提供します。inserter
- リクエスト本文に使用する本文挿入子 BodyInserters
<T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, ClassSE<T> elementClass)
body(BodyInserter)
のショートカット。例:MonopersonMono = ... ; Mono 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> typeReference)
ParameterizedTypeReference
を介してジェネリクスを含む要素型情報を提供できる body(Publisher, Class)
のバリアント。T
- パブリッシャーに含まれる要素の型 P
- Publisher
の型 publisher
- リクエストに書き込む Publisher
typeReference
- パブリッシャーに含まれる要素の型参照 WebClient.RequestHeadersSpec<?> syncBody(ObjectSE body)
body(BodyInserter)
のショートカット。例:Person person = ... ; Mono<Void> result = client.post() .uri("/persons/{id}", id) .contentType(MediaType.APPLICATION_JSON) .syncBody(person) .retrieve() .bodyToMono(Void.class);
マルチパートリクエストの場合は、MultiValueMap
を提供します。MultiValueMap
の値は、パーツのボディを表す任意のオブジェクト、またはボディとヘッダーを持つパーツを表す HttpEntity
です。MultiValueMap
は MultipartBodyBuilder
で構築できます。
body
- リクエストに書き込む Object