Class ClientResponseEntity
java.lang.Object
io.helidon.http.media.ReadableEntityBase
io.helidon.webclient.api.ClientResponseEntity
- All Implemented Interfaces:
ReadableEntity
Client response entity.
-
Method Summary
Modifier and TypeMethodDescriptionCopy this entity and add a new runnable to be executed after this entity is consumed.static ClientResponseEntitycreate(Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ClientRequestHeaders requestHeaders, ClientResponseHeaders responseHeaders, MediaContext mediaContext, long maxBufferedEntitySize) Create a new client response entity.protected <T> TentityAs(GenericType<T> type) Read entity as a specific generic type.Methods inherited from class ReadableEntityBase
as, as, asOptional, asOptional, buffer, consume, consumed, empty, entityProcessedRunnable, hasEntity, inputStream, 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.Input stream to read bytes of the entity.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
public static ClientResponseEntity create(Function<Integer, BufferData> readEntityFunction, Runnable entityProcessedRunnable, ClientRequestHeaders requestHeaders, ClientResponseHeaders responseHeaders, MediaContext mediaContext, long maxBufferedEntitySize) Create a new client response entity.- Parameters:
readEntityFunction- function to read bytes from entity based on suggested buffer lengthentityProcessedRunnable- runnable to run when entity processing finishesrequestHeaders- request headersresponseHeaders- response headersmediaContext- media context to read into specific typesmaxBufferedEntitySize- maximum size of a buffered entity- Returns:
- client response 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
-
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
-