Class ImmediateMultiObjectBody

All Implemented Interfaces:
HttpBody, MultiObjectBody

@Internal public final class ImmediateMultiObjectBody extends Object implements MultiObjectBody
Immediate MultiObjectBody, all operations are eager.
Jonas Konrad
  • Method Details

    • single

      public ImmediateSingleObjectBody single(Charset defaultCharset, io.netty.buffer.ByteBufAllocator alloc)
    • toMap

      public static Map<String,Object> toMap(Charset charset, Collection<? extends MicronautHttpData<?>> dataList)
    • coerceToInputStream

      public InputStream coerceToInputStream(io.netty.buffer.ByteBufAllocator alloc)
      Description copied from interface: MultiObjectBody
      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.
      Specified by:
      coerceToInputStream in interface MultiObjectBody
      alloc - The buffer allocator to use
      The stream that reads the data in this body
    • asPublisher

      public Publisher<?> asPublisher()
      Description copied from interface: MultiObjectBody
      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.
      Specified by:
      asPublisher in interface MultiObjectBody
      The publisher
    • mapNotNull

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

      public void handleForm(FormRouteCompleter formRouteCompleter)
      Description copied from interface: MultiObjectBody
      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.
      Specified by:
      handleForm in interface MultiObjectBody
      formRouteCompleter - The form route completer that should take over processing
    • release

      public final void release()
      Description copied from interface: HttpBody
      Release this body and any downstream representations.
      Specified by:
      release in interface HttpBody
    • next

      @Nullable public @Nullable HttpBody next()
      Description copied from interface: HttpBody
      Get the next representation this body was transformed into, if any.
      Specified by:
      next in interface HttpBody
      The next representation, or null if this body has not been transformed