- java.lang.Object
-
- io.helidon.media.common.MessageBodyContext
-
- All Implemented Interfaces:
MessageBodyFilters
- Direct Known Subclasses:
MessageBodyReaderContext,MessageBodyWriterContext
public abstract class MessageBodyContext extends Object implements MessageBodyFilters
Base message body context implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMessageBodyContext.ErrorEventA subscription event emitted forMessageBodyContext.EventType.BEFORE_ONERRORorMessageBodyContext.EventType.AFTER_ONERRORthat carries the received error.static interfaceMessageBodyContext.EventMessage body content subscription event contract.static interfaceMessageBodyContext.EventListenerMessage body content subscription event listener.static classMessageBodyContext.EventTypeMessage body content subscription event types.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMessageBodyContext(MessageBodyContext parent, MessageBodyContext.EventListener eventListener)Create a new parented content support instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Flow.Publisher<DataChunk>applyFilters(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 Charsetcharset()Derive the charset to use from theContent-Typeheader value or using a default charset as fallback.MessageBodyContextregisterFilter(MessageBodyFilter filter)Register a message body filter.voidregisterFilter(Function<Flow.Publisher<DataChunk>,Flow.Publisher<DataChunk>> function)Deprecated.useregisterFilter(MessageBodyFilter)instead
-
-
-
Constructor Detail
-
MessageBodyContext
protected MessageBodyContext(MessageBodyContext parent, MessageBodyContext.EventListener eventListener)
Create a new parented content support instance.- Parameters:
parent- content filters parenteventListener- event listener
-
-
Method Detail
-
charset
public abstract Charset charset() throws IllegalStateException
Derive the charset to use from theContent-Typeheader value or using a default charset as fallback.- Returns:
- Charset, never
null - Throws:
IllegalStateException- if an error occurs loading the charset specified by theContent-Typeheader value
-
registerFilter
public MessageBodyContext registerFilter(MessageBodyFilter filter)
Description copied from interface:MessageBodyFiltersRegister a message body filter.- Specified by:
registerFilterin interfaceMessageBodyFilters- Parameters:
filter- message body filter to register- Returns:
- MessageBodyFilters
-
registerFilter
@Deprecated public void registerFilter(Function<Flow.Publisher<DataChunk>,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterFilter(MessageBodyFilter)insteadRegister a function filter.- Parameters:
function- filter function
-
applyFilters
public Flow.Publisher<DataChunk> applyFilters(Flow.Publisher<DataChunk> publisher)
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
-
-