java.lang.Object
io.helidon.media.common.MessageBodyContext
- All Implemented Interfaces:
MessageBodyFilters
- Direct Known Subclasses:
MessageBodyReaderContext
,MessageBodyWriterContext
Base message body context implementation.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A subscription event emitted forMessageBodyContext.EventType.BEFORE_ONERROR
orMessageBodyContext.EventType.AFTER_ONERROR
that carries the received error.static interface
Message body content subscription event contract.static interface
Message body content subscription event listener.static enum
Message body content subscription event types. -
Constructor Summary
ModifierConstructorDescriptionprotected
MessageBodyContext
(MessageBodyContext parent) Create a new parented content support instance.protected
MessageBodyContext
(MessageBodyContext parent, MessageBodyContext.EventListener eventListener) Create a new parented content support instance. -
Method Summary
Modifier and TypeMethodDescriptionapplyFilters
(Flow.Publisher<DataChunk> publisher) Apply the filters on the given input publisher to form a publisher chain.protected Flow.Publisher<DataChunk>
applyFilters
(Flow.Publisher<DataChunk> publisher, GenericType<?> type) Apply the filters on the given input publisher to form a publisher chain.abstract Charset
charset()
Derive the charset to use from theContent-Type
header value or using a default charset as fallback.registerFilter
(MessageBodyFilter filter) Registers a message body filter.
-
Constructor Details
-
MessageBodyContext
protected MessageBodyContext(MessageBodyContext parent, MessageBodyContext.EventListener eventListener) Create a new parented content support instance.- Parameters:
parent
- content filters parenteventListener
- event listener
-
MessageBodyContext
Create a new parented content support instance.- Parameters:
parent
- content filters parent
-
-
Method Details
-
charset
Derive the charset to use from theContent-Type
header value or using a default charset as fallback.- Returns:
- Charset, never
null
- Throws:
IllegalStateException
- if an error occurs loading the charset specified by theContent-Type
header value
-
registerFilter
Description copied from interface:MessageBodyFilters
Registers a message body filter.The registered filters are applied to form a chain from the first registered to the last registered. The first evaluation of the function transforms the original publisher to a new publisher. Any subsequent evaluation receives the publisher transformed by the last previously registered filter.
- Specified by:
registerFilter
in interfaceMessageBodyFilters
- Parameters:
filter
- a function to map previously registered or originalPublisher
to the new one. If returnsnull
then the result will be ignored.- Returns:
- this instance of
MessageBodyFilters
- See Also:
-
applyFilters
Apply the filters on the given input publisher to form a publisher chain.- Parameters:
publisher
- input publisher- Returns:
- tail of the publisher chain
-
applyFilters
protected Flow.Publisher<DataChunk> applyFilters(Flow.Publisher<DataChunk> publisher, GenericType<?> type) Apply the filters on the given input publisher to form a publisher chain.- Parameters:
publisher
- input publishertype
- type information associated with the input publisher- Returns:
- tail of the publisher chain
-