接口 WebClient.RequestBodySpec
- 所有已知子接口:
WebClient.RequestBodyUriSpec
- 封闭接口:
- WebClient
public static interface WebClient.RequestBodySpec
extends WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
Contract for specifying request headers and body leading up to the exchange.
-
方法概要
修饰符和类型方法说明body(BodyInserter<?, ? super ClientHttpRequest> inserter) Set the body of the request using the given body inserter.Variant ofbody(Publisher, ParameterizedTypeReference)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.Variant ofbody(Publisher, Class)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.<T,P extends org.reactivestreams.Publisher<T>>
WebClient.RequestHeadersSpec<?>body(P publisher, cn.taketoday.core.ParameterizedTypeReference<T> elementTypeRef) Variant ofbody(Publisher, Class)that allows providing element type information with generics.<T,P extends org.reactivestreams.Publisher<T>>
WebClient.RequestHeadersSpec<?>Shortcut forbody(BodyInserter)with a Publisher inserter.Shortcut forbody(BodyInserter)with a value inserter.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.从接口继承的方法 cn.taketoday.web.reactive.function.client.WebClient.RequestHeadersSpec
accept, acceptCharset, attribute, attributes, context, cookie, cookies, exchange, exchangeToFlux, exchangeToMono, header, headers, httpRequest, ifModifiedSince, ifNoneMatch, retrieve
-
方法详细资料
-
contentLength
Set the length of the body in bytes, as specified by theContent-Lengthheader.- 参数:
contentLength- the content length- 返回:
- this builder
- 另请参阅:
-
contentType
Set the media type of the body, as specified by theContent-Typeheader.- 参数:
contentType- the content type- 返回:
- this builder
- 另请参阅:
-
bodyValue
Shortcut forbody(BodyInserter)with a value inserter. For example:Person person = ... ; Mono<Void> result = client.post() .uri("/persons/{id}", id) .contentType(MediaType.APPLICATION_JSON) .bodyValue(person) .retrieve() .bodyToMono(Void.class);For multipart requests consider providing
MultiValueMapprepared withMultipartBodyBuilder.- 参数:
body- the value to write to the request body- 返回:
- this builder
- 抛出:
IllegalArgumentException- ifbodyis aPublisheror producer known toReactiveAdapterRegistry
-
body
<T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, Class<T> elementClass) Shortcut forbody(BodyInserter)with a Publisher inserter. For example: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- the type of the elements contained in the publisherP- the type of thePublisher- 参数:
publisher- thePublisherto write to the requestelementClass- the type of elements published- 返回:
- this builder
-
body
<T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, cn.taketoday.core.ParameterizedTypeReference<T> elementTypeRef) Variant ofbody(Publisher, Class)that allows providing element type information with generics.- 类型参数:
T- the type of the elements contained in the publisherP- the type of thePublisher- 参数:
publisher- thePublisherto write to the requestelementTypeRef- the type of elements published- 返回:
- this builder
-
body
Variant ofbody(Publisher, Class)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.- 参数:
producer- the producer to write to the requestelementClass- the type of elements produced- 返回:
- this builder
-
body
WebClient.RequestHeadersSpec<?> body(Object producer, cn.taketoday.core.ParameterizedTypeReference<?> elementTypeRef) Variant ofbody(Publisher, ParameterizedTypeReference)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.- 参数:
producer- the producer to write to the requestelementTypeRef- the type of elements produced- 返回:
- this builder
-
body
Set the body of the request using the given body inserter. SeeBodyInsertersfor built-inBodyInserterimplementations.- 参数:
inserter- the body inserter to use for the request body- 返回:
- this builder
- 另请参阅:
-