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 payload publisher.

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

      RequestBody before(Mono<Void> before)
      Description copied from interface: RequestBody

      Transforms the payload publisher to subscribe to the specified publisher before subscribing to the payload publisher.

      This basically allows to perform actions before the request is actually sent.

      Specified by:
      before in interface RequestBody
      Parameters:
      before - the publisher to subscribe before the request body publisher
      Returns:
      the request body
    • after

      RequestBody after(Mono<Void> after)
      Description copied from interface: RequestBody

      Transforms the payload publisher to subscribe to the specified publisher after payload publisher completion.

      This basically allows to perform actions after the request has been sent.

      Specified by:
      after in interface RequestBody
      Parameters:
      after - the publisher to subscribe before the request body publisher
      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