public interface EntityReaderContext
Entity-reading policy for nested entities, such as individual multipart parts.
A reader can retain this context when returning a lazy entity. Each conversion through the context
applies the original entity's materialization limit independently and preserves its limit-failure policy.
The limit counts decoded input bytes consumed by a materializing reader, rather than the resulting heap usage.
A server request limit failure is reported as
HttpException with status 413;
a client response limit failure is reported as IllegalStateException.
The limit-failure policy is inherited from the original entity, independently of the nested headers or read overload.
Streaming readers bypass that limit; other limits already applied to the supplied stream remain effective.
The selected reader retains responsibility for stream ownership as described by EntityReader.streaming().-
Method Summary
Modifier and TypeMethodDescription<T> Tread(EntityReader<T> reader, GenericType<T> type, InputStream stream, Headers headers) Read a nested entity using the selected reader's server-request read overload.<T> Tread(EntityReader<T> reader, GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders) Read a nested entity using the selected reader's client-response read overload.
-
Method Details
-
read
Read a nested entity using the selected reader's server-request read overload. Each materializing conversion has its own byte counter. A limit failure remains observable even if the selected reader wraps it or returns normally after catching it.- Type Parameters:
T- entity type- Parameters:
reader- selected media readertype- entity typestream- stream of the nested entity's contentheaders- nested entity headers- Returns:
- converted entity
-
read
<T> T read(EntityReader<T> reader, GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders) Read a nested entity using the selected reader's client-response read overload. Each materializing conversion has its own byte counter. A limit failure remains observable even if the selected reader wraps it or returns normally after catching it.- Type Parameters:
T- entity type- Parameters:
reader- selected media readertype- entity typestream- stream of the nested entity's contentrequestHeaders- request headersresponseHeaders- nested response entity headers- Returns:
- converted entity
-