Interface MultiObjectBody

All Superinterfaces:
HttpBody
All Known Implementing Classes:
ImmediateMultiObjectBody, ImmediateSingleObjectBody, StreamingMultiObjectBody

@Internal public sealed interface MultiObjectBody extends HttpBody permits ImmediateMultiObjectBody, ImmediateSingleObjectBody, StreamingMultiObjectBody
A body consisting of multiple objects of arbitrary type. Basically a Publisher<?>. This class is so generic for compatibility reasons, it's the result of processing a ByteBody using a HttpContentProcessor.
Since:
4.0.0
Author:
Jonas Konrad
  • Method Details

    • coerceToInputStream

      InputStream coerceToInputStream(io.netty.buffer.ByteBufAllocator alloc)
      Coerce this value to an InputStream. This implements NettyInputStreamBodyBinder. Requires the objects of this body to be ByteBufs.
      Ownership is transferred to the stream, it must be closed to release all buffers.
      Parameters:
      alloc - The buffer allocator to use
      Returns:
      The stream that reads the data in this body
    • asPublisher

      Publisher<?> asPublisher()
      Get this value as a publisher. The publisher must be subscribed to exactly once. All objects forwarded to the subscriber become its responsibility and must be released by the subscriber.
      Returns:
      The publisher
    • mapNotNull

      MultiObjectBody mapNotNull(Function<Object,Object> transform)
      Apply a mapping function to all objects in this body. null values in the output are skipped.
      Parameters:
      transform - The mapping function
      Returns:
      A new body with the mapped values
    • handleForm

      void handleForm(FormRouteCompleter formRouteCompleter)
      Special handling for form data. This method basically acts like asPublisher().subscribe(formRouteCompleter). However, FormRouteCompleter needs to release the form data fields when the request is destroyed. To do this, it implements HttpBody.release(). By calling this method, the FormRouteCompleter is registered as the next body and will be released.
      Parameters:
      formRouteCompleter - The form route completer that should take over processing