接口 WebClient.RequestBodySpec

所有超级接口:
WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
所有已知子接口:
WebClient.RequestBodyUriSpec
所有已知实现类:
DefaultWebClient.DefaultRequestBodyUriSpec
封闭接口:
WebClient

public static interface WebClient.RequestBodySpec extends WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
Contract for specifying request headers and body leading up to the exchange.
  • 方法详细资料

    • contentLength

      WebClient.RequestBodySpec contentLength(long contentLength)
      Set the length of the body in bytes, as specified by the Content-Length header.
      参数:
      contentLength - the content length
      返回:
      this builder
      另请参阅:
    • contentType

      WebClient.RequestBodySpec contentType(MediaType contentType)
      Set the media type of the body, as specified by the Content-Type header.
      参数:
      contentType - the content type
      返回:
      this builder
      另请参阅:
    • bodyValue

      Shortcut for body(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 MultiValueMap prepared with MultipartBodyBuilder.

      参数:
      body - the value to write to the request body
      返回:
      this builder
      抛出:
      IllegalArgumentException - if body is a Publisher or producer known to ReactiveAdapterRegistry
    • body

      <T, P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, Class<T> elementClass)
      Shortcut for body(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 publisher
      P - the type of the Publisher
      参数:
      publisher - the Publisher to write to the request
      elementClass - 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 of body(Publisher, Class) that allows providing element type information with generics.
      类型参数:
      T - the type of the elements contained in the publisher
      P - the type of the Publisher
      参数:
      publisher - the Publisher to write to the request
      elementTypeRef - the type of elements published
      返回:
      this builder
    • body

      WebClient.RequestHeadersSpec<?> body(Object producer, Class<?> elementClass)
      Variant of body(Publisher, Class) that allows using any producer that can be resolved to Publisher via ReactiveAdapterRegistry.
      参数:
      producer - the producer to write to the request
      elementClass - the type of elements produced
      返回:
      this builder
    • body

      WebClient.RequestHeadersSpec<?> body(Object producer, cn.taketoday.core.ParameterizedTypeReference<?> elementTypeRef)
      Variant of body(Publisher, ParameterizedTypeReference) that allows using any producer that can be resolved to Publisher via ReactiveAdapterRegistry.
      参数:
      producer - the producer to write to the request
      elementTypeRef - the type of elements produced
      返回:
      this builder
    • body

      Set the body of the request using the given body inserter. See BodyInserters for built-in BodyInserter implementations.
      参数:
      inserter - the body inserter to use for the request body
      返回:
      this builder
      另请参阅: