- java.lang.Object
-
- io.helidon.media.common.MessageBodyWriteableContent
-
- All Implemented Interfaces:
MessageBodyContent,MessageBodyFilters,MessageBodyWriters,Flow.Publisher<DataChunk>
public final class MessageBodyWriteableContent extends Object implements MessageBodyContent, MessageBodyWriters, MessageBodyFilters
Implementation ofWriteableContent.
-
-
Method Summary
-
-
-
Method Detail
-
writerContext
public MessageBodyWriterContext writerContext()
Get the writer context used to marshall data.- Returns:
- MessageBodyWriterContext
-
subscribe
public void subscribe(Flow.Subscriber<? super DataChunk> subscriber)
- Specified by:
subscribein interfaceFlow.Publisher<DataChunk>
-
toPublisher
public Flow.Publisher<DataChunk> toPublisher(MessageBodyWriterContext fallback)
Convert this writeable content to a raw publisher.- Parameters:
fallback- fallback context to use, may benull- Returns:
- publisher, never
null
-
registerFilter
public MessageBodyWriteableContent 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
-
registerWriter
public MessageBodyWriteableContent registerWriter(MessageBodyWriter<?> writer)
Description copied from interface:MessageBodyWritersRegister a writer.- Specified by:
registerWriterin interfaceMessageBodyWriters- Parameters:
writer- writer to register- Returns:
- Writers
-
registerWriter
public MessageBodyWriteableContent registerWriter(MessageBodyStreamWriter<?> writer)
Description copied from interface:MessageBodyWritersRegister a stream writer.- Specified by:
registerWriterin interfaceMessageBodyWriters- Parameters:
writer- writer to register- Returns:
- Writers
-
registerWriter
@Deprecated public <T> MessageBodyWriteableContent registerWriter(Class<T> type, Function<T,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterWriter(MessageBodyWriter)insteadRegisters a writer function with a given type.- Type Parameters:
T- entity type- Parameters:
type- class representing the type supported by this writerfunction- writer function- Returns:
- this
MessageBodyWriteableContentinstance
-
registerWriter
@Deprecated public <T> MessageBodyWriteableContent registerWriter(Class<T> type, MediaType contentType, Function<? extends T,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterWriter(MessageBodyWriter)insteadRegisters a writer function with a given type and media type.- Type Parameters:
T- entity type- Parameters:
type- class representing the type supported by this writercontentType- the media typefunction- writer function- Returns:
- this
MessageBodyWriteableContentinstance
-
registerWriter
@Deprecated public <T> MessageBodyWriteableContent registerWriter(Predicate<?> accept, Function<T,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterWriter(MessageBodyWriter)insteadRegisters a writer function with a given predicate.- Type Parameters:
T- entity type- Parameters:
accept- the object predicatefunction- writer function- Returns:
- this
MessageBodyWriteableContentinstance
-
registerWriter
@Deprecated public <T> MessageBodyWriteableContent registerWriter(Predicate<?> accept, MediaType contentType, Function<T,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterWriter(MessageBodyWriter)insteadRegisters a writer function with a given predicate and media type.- Type Parameters:
T- entity type- Parameters:
accept- the object predicatecontentType- the media typefunction- writer function- Returns:
- this
MessageBodyWriteableContentinstance
-
registerFilter
@Deprecated public void registerFilter(Function<Flow.Publisher<DataChunk>,Flow.Publisher<DataChunk>> function)
Deprecated.useregisterFilter(MessageBodyFilter)insteadRegister a filter function.- Parameters:
function- filter function
-
create
public static MessageBodyWriteableContent create(Object entity, Parameters headers)
Create a new writeable content backed by an entity object.- Parameters:
entity- object, must not benullheaders- writer context backing headers, must not benull- Returns:
- MessageBodyWriteableContent
-
create
public static MessageBodyWriteableContent create(Flow.Publisher<Object> stream, GenericType<? extends Object> type, Parameters headers)
Create a new writeable content backed by an entity stream.- Parameters:
stream- entity stream, must not benulltype- actual type representation, must not benullheaders- writer context backing headers, must not benull- Returns:
- MessageBodyWriteableContent
-
create
public static MessageBodyWriteableContent create(Flow.Publisher<DataChunk> publisher, Parameters headers)
Create a new writeable content backed by a raw publisher.- Parameters:
publisher- raw publisherheaders- writer context backing headers, must not benull- Returns:
- MessageBodyWriteableContent
-
-