Class ServerRequestEntity
java.lang.Object
io.helidon.http.media.ReadableEntityBase
io.helidon.webserver.http.ServerRequestEntity
- All Implemented Interfaces:
ReadableEntity
Server request entity.
-
Method Summary
Modifier and TypeMethodDescriptionCopy this entity and add a new runnable to be executed after this entity is consumed.static ServerRequestEntitycreate(Consumer<Boolean> entityRequestedCallback, UnaryOperator<InputStream> streamFilter, ContentDecoder decoder, Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ServerRequestHeaders requestHeaders, MediaContext mediaContext, long maxBufferedEntitySize) Deprecated.static ServerRequestEntitycreate(Consumer<Boolean> entityRequestedCallback, UnaryOperator<InputStream> streamFilter, ContentDecoder decoder, Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ServerRequestHeaders requestHeaders, MediaContext mediaContext, long maxPayloadSize, long maxBufferedEntitySize) Create a new entity.protected <T> TentityAs(GenericType<T> type) Read entity as a specific generic type.Input stream to read bytes of the entity.Methods inherited from class ReadableEntityBase
as, as, asOptional, asOptional, buffer, consume, consumed, empty, entityProcessedRunnable, hasEntity, maxBufferedEntitySize, readAllBytes, readEntityFunctionModifier and TypeMethodDescriptionfinal <T> Tas(GenericType<T> type) Get the entity as a specific type.<T> TGet the entity as a specific class.<T> Optional<T> asOptional(GenericType<T> type) Get the entity as a specific type (optional).<T> Optional<T> asOptional(Class<T> type) Get the entity as a specific class (optional).voidbuffer()If called beforeReadableEntity.inputStream(), it will buffer the entity and support multiple calls toReadableEntity.inputStream()after that.voidconsume()Consume the entity if not yet consumed.booleanconsumed()Whether this entity has been consumed already.static ReadableEntityempty()Create a new empty readable entity (when there is no entity).protected RunnableRunnable to run once the entity is fully consumed.booleanWhether an entity actually exists.protected longMax entity length of a bufferable entity.protected byte[]Read all bytes of the entity into memory.protected Function<Integer, BufferData> Function to request entity bytes.
-
Method Details
-
create
@Deprecated(since="4.4.2") public static ServerRequestEntity create(Consumer<Boolean> entityRequestedCallback, UnaryOperator<InputStream> streamFilter, ContentDecoder decoder, Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ServerRequestHeaders requestHeaders, MediaContext mediaContext, long maxBufferedEntitySize) Deprecated.Create a new entity.- Parameters:
entityRequestedCallback- callback invoked when entity data are requested for the first timestreamFilter- stream filter to apply, provided by userdecoder- content decoderreadEntityFunction- 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 readrequestHeaders- request headersmediaContext- media context to map to correct typesmaxBufferedEntitySize- maximum size of a buffered entity- Returns:
- a new entity
-
create
public static ServerRequestEntity create(Consumer<Boolean> entityRequestedCallback, UnaryOperator<InputStream> streamFilter, ContentDecoder decoder, Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ServerRequestHeaders requestHeaders, MediaContext mediaContext, long maxPayloadSize, long maxBufferedEntitySize) Create a new entity.- Parameters:
entityRequestedCallback- callback invoked when entity data are requested for the first timestreamFilter- stream filter to apply, provided by userdecoder- content decoderreadEntityFunction- 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 readrequestHeaders- request headersmediaContext- media context to map to correct typesmaxPayloadSize- maximum size of a decoded entitymaxBufferedEntitySize- maximum size of a buffered entity- Returns:
- a new entity
-
copy
Description copied from interface:ReadableEntityCopy this entity and add a new runnable to be executed after this entity is consumed.- Specified by:
copyin interfaceReadableEntity- Parameters:
entityProcessedRunnable- runnable to execute on consumed entity- Returns:
- a new entity delegating to this entity
-
inputStream
Description copied from interface:ReadableEntityInput stream to read bytes of the entity. Cannot be combined with methodsReadableEntity.as(Class)orReadableEntity.as(io.helidon.common.GenericType)If there is no entity, returns input stream on empty byte array.- Specified by:
inputStreamin interfaceReadableEntity- Overrides:
inputStreamin classReadableEntityBase- Returns:
- input stream to entity bytes
-
entityAs
Description copied from class:ReadableEntityBaseRead entity as a specific generic type.- Specified by:
entityAsin classReadableEntityBase- Type Parameters:
T- type of the entity- Parameters:
type- type the entity should be coerced into- Returns:
- entity value
-
create(Consumer, UnaryOperator, ContentDecoder, Function, Runnable, ServerRequestHeaders, MediaContext, long, long)instead