Class MessageBodyReadableContent
- All Implemented Interfaces:
Multi<DataChunk>,Subscribable<DataChunk>,MessageBodyContent,MessageBodyFilters,MessageBodyReaders,Flow.Publisher<DataChunk>
MessageBodyContent.-
Method Summary
Modifier and TypeMethodDescription<T> Single<T>as(GenericType<T> type) Consumes and converts the content payload into a completion stage of the requested type.<T> Single<T>Consumes and converts the request content into a completion stage of the requested type.<T> Multi<T>asStream(GenericType<T> type) Consumes and converts the content payload into a stream of entities of the requested type.<T> Multi<T>Consumes and converts the content payload into a stream of entities of the requested type.static MessageBodyReadableContentcreate(Flow.Publisher<DataChunk> publisher, MessageBodyReaderContext context) Create a new readable content backed by the given publisher and context.Get the reader context used to unmarshall data.registerFilter(MessageBodyFilter filter) Registers a message body filter.registerReader(MessageBodyReader<?> reader) Register a reader.registerReader(MessageBodyStreamReader<?> reader) Register a stream reader.voidsubscribe(Flow.Subscriber<? super DataChunk> subscriber) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.common.reactive.Multi
collect, collect, collectList, collectStream, compose, defaultIfEmpty, defaultIfEmpty, distinct, dropWhile, filter, first, flatMap, flatMap, flatMapCompletionStage, flatMapIterable, flatMapIterable, flatMapOptional, forEach, forEachCompletionStage, ifEmpty, ignoreElements, limit, log, log, log, log, map, observeOn, observeOn, onCancel, onComplete, onCompleteResume, onCompleteResumeWith, onError, onErrorResume, onErrorResumeWith, onTerminate, peek, reduce, reduce, retry, retry, retryWhen, skip, switchIfEmpty, takeUntil, takeWhile, timeout, timeout, toMethods inherited from interface io.helidon.common.reactive.Subscribable
subscribe, subscribe, subscribe, subscribe
-
Method Details
-
readerContext
Get the reader context used to unmarshall data.- Returns:
- MessageBodyReaderContext
-
registerFilter
Description copied from interface:MessageBodyFiltersRegisters 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:
registerFilterin interfaceMessageBodyFilters- Parameters:
filter- a function to map previously registered or originalPublisherto the new one. If returnsnullthen the result will be ignored.- Returns:
- this instance of
MessageBodyFilters - See Also:
-
registerReader
Description copied from interface:MessageBodyReadersRegister a reader.- Specified by:
registerReaderin interfaceMessageBodyReaders- Parameters:
reader- reader to register- Returns:
- Readers
-
registerReader
Description copied from interface:MessageBodyReadersRegister a stream reader.- Specified by:
registerReaderin interfaceMessageBodyReaders- Parameters:
reader- reader to register- Returns:
- Readers
-
subscribe
- Specified by:
subscribein interfaceFlow.Publisher<DataChunk>
-
as
Consumes and converts the request content into a completion stage of the requested type.The conversion requires an appropriate reader to be already registered (see
registerReader(MessageBodyReader)). If no such reader is found, the resulting completion stage ends exceptionally.Any callback related to the returned value, should not be blocking. Blocking operation could cause deadlock. If you need to use blocking API such as
InputStreamit is highly recommended to do so out of the scope of reactive chain, or to use methods likeCompletionStage.thenAcceptAsync(java.util.function.Consumer, java.util.concurrent.Executor).- Type Parameters:
T- the requested type- Parameters:
type- the requested type class- Returns:
- a completion stage of the requested type
-
as
Consumes and converts the content payload into a completion stage of the requested type.- Type Parameters:
T- the requested type- Parameters:
type- the requested type class- Returns:
- a completion stage of the requested type
-
asStream
Consumes and converts the content payload into a stream of entities of the requested type.- Type Parameters:
T- the requested type- Parameters:
type- the requested type class- Returns:
- a stream of entities
-
asStream
Consumes and converts the content payload into a stream of entities of the requested type.- Type Parameters:
T- the requested type- Parameters:
type- the requested type class- Returns:
- a stream of entities
-
create
public static MessageBodyReadableContent create(Flow.Publisher<DataChunk> publisher, MessageBodyReaderContext context) Create a new readable content backed by the given publisher and context.- Parameters:
publisher- content publishercontext- reader context- Returns:
- MessageBodyReadableContent
-