Class ServerRequestEntity

java.lang.Object
io.helidon.http.media.ReadableEntityBase
io.helidon.webserver.http.ServerRequestEntity
All Implemented Interfaces:
ReadableEntity

public final class ServerRequestEntity extends ReadableEntityBase implements ReadableEntity
Server request entity.
  • Method Details

    • create

      public static ServerRequestEntity create(Consumer<Boolean> entityRequestedCallback, UnaryOperator<InputStream> streamFilter, ContentDecoder decoder, Function<Integer,BufferData> readEntityFunction, Runnable entityProcessedRunnable, ServerRequestHeaders requestHeaders, MediaContext mediaContext)
      Create a new entity.
      Parameters:
      entityRequestedCallback - callback invoked when entity data are requested for the first time
      streamFilter - stream filter to apply, provided by user
      decoder - content decoder
      readEntityFunction - function to read buffer from entity (int is an estimated number of bytes needed, buffer will contain at least 1 byte)
      entityProcessedRunnable - runnable to run once the entity is fully read
      requestHeaders - request headers
      mediaContext - media context to map to correct types
      Returns:
      a new entity
    • copy

      public ReadableEntity copy(Runnable entityProcessedRunnable)
      Description copied from interface: ReadableEntity
      Copy this entity and add a new runnable to be executed after this entity is consumed.
      Specified by:
      copy in interface ReadableEntity
      Parameters:
      entityProcessedRunnable - runnable to execute on consumed entity
      Returns:
      a new entity delegating to this entity
    • inputStream

      public InputStream inputStream()
      Description copied from interface: ReadableEntity
      Input stream to read bytes of the entity. Cannot be combined with methods ReadableEntity.as(Class) or ReadableEntity.as(io.helidon.common.GenericType) If there is no entity, returns input stream on empty byte array.
      Specified by:
      inputStream in interface ReadableEntity
      Overrides:
      inputStream in class ReadableEntityBase
      Returns:
      input stream to entity bytes
    • entityAs

      protected <T> T entityAs(GenericType<T> type)
      Description copied from class: ReadableEntityBase
      Read entity as a specific generic type.
      Specified by:
      entityAs in class ReadableEntityBase
      Type Parameters:
      T - type of the entity
      Parameters:
      type - type the entity should be coerced into
      Returns:
      entity value