Interface MultiObjectBody

All Superinterfaces:
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.
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.
      alloc - The buffer allocator to use
      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.
      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.
      transform - The mapping function
      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.
      formRouteCompleter - The form route completer that should take over processing