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 TypeMethodDescriptionprotected RuntimeExceptionException to throw when explicit buffering exceeds its configured size.Copy 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.protected RuntimeExceptionException to throw when a materializing reader exceeds its configured size limit.Methods inherited from class ReadableEntityBase
as, as, asOptional, asOptional, buffer, bufferedEntityAvailable, consume, consumed, empty, entityProcessedRunnable, hasEntity, maxBufferedEntitySize, readAllBytes, readEntity, readEntity, 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.protected booleanWhether an entity has been buffered and can be read again.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 longMaximum entity length for materializing reads and explicit buffering.protected byte[]Read all bytes of the entity into memory.protected <T> TreadEntity(EntityReader<T> reader, GenericType<T> type, Headers headers) Read a server request with the selected media reader, enforcing the materialization limit.protected <T> TreadEntity(EntityReader<T> reader, GenericType<T> type, Headers requestHeaders, Headers responseHeaders) Read a client response with the selected media reader, enforcing the materialization limit.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. This stream is not limited bymax-buffered-entity-size.- Specified by:
inputStreamin interfaceReadableEntity- Overrides:
inputStreamin classReadableEntityBase- Returns:
- input stream to entity bytes
-
bufferedEntityLimitExceeded
Description copied from class:ReadableEntityBaseException to throw when explicit buffering exceeds its configured size.- Overrides:
bufferedEntityLimitExceededin classReadableEntityBase- Returns:
- exception for a buffered entity that exceeds the limit
-
materializedEntityLimitExceeded
Description copied from class:ReadableEntityBaseException to throw when a materializing reader exceeds its configured size limit. Server request implementations override this to produce an HTTP error response.- Overrides:
materializedEntityLimitExceededin classReadableEntityBase- Returns:
- exception for a materialized entity that exceeds the limit
-
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