接口 RestClient.RequestBodySpec

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

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

    • contentLength

      RestClient.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

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

      Set the body of the request to the given Object. For example:

      
       Person person = ... ;
       ResponseEntity<Void> response = client.post()
           .uri("/persons/{id}", id)
           .contentType(MediaType.APPLICATION_JSON)
           .body(person)
           .retrieve()
           .toBodilessEntity();
       
      参数:
      body - the body of the response
      返回:
      the built response
    • body

      <T> RestClient.RequestBodySpec body(T body, cn.taketoday.core.ParameterizedTypeReference<T> bodyType)
      Set the body of the response to the given Object. The parameter bodyType is used to capture the generic type.
      参数:
      body - the body of the response
      bodyType - the type of the body, used to capture the generic type
      返回:
      the built response
    • body

      Set the body of the response to the given function that writes to an OutputStream.
      参数:
      body - a function that takes an OutputStream and can throw an IOException
      返回:
      the built response