Interface WebRequestBody

All Superinterfaces:
RequestBody

public interface WebRequestBody extends RequestBody

A Web request body with payload encoding support.

Implementors should rely on MediaTypeConverter to encode a payload based on the content type of the request.

Since:
1.12
Author:
Jeremy Kuhn
  • Method Details

    • transform

      Description copied from interface: RequestBody

      Transforms the request payload publisher.

      Specified by:
      transform in interface RequestBody
      Parameters:
      transformer - a payload publisher transformer
      Returns:
      the request body
    • encoder

      <T> OutboundDataEncoder<T> encoder()

      Returns an encoder to encode a payload based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Returns:
      a data encoder
    • encoder

      <T> OutboundDataEncoder<T> encoder(Class<T> type)

      Returns an encoder to encode a payload of the specified type based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Parameters:
      type - a class of T
      Returns:
      a data encoder
    • encoder

      <T> OutboundDataEncoder<T> encoder(Type type)

      Returns an encoder to encode a payload of the specified type based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Parameters:
      type - the type to encode
      Returns:
      a data encoder
    • multipart

      Description copied from interface: RequestBody

      Returns a Multipart form data producer.

      A typical usage is:

      
       exchange.request().body().ifPresent(body -> body.multipart().from( 
           (factory, output) -> output.stream(Flux.just(
               factory.string(part -> part.name("key").value("value")),
               factory.resource(part -> part
                   .name("myfile")
                   .headers(headers -> headers.contentType("application/json"))
                   .value(new FileResource("sample.json")))
       ))));
       
      Specified by:
      multipart in interface RequestBody
      Returns:
      a Multipart form data producer