Class MessageBodyContext

    • Constructor Detail

      • MessageBodyContext

        protected MessageBodyContext​(MessageBodyContext parent,
                                     MessageBodyContext.EventListener eventListener)
        Create a new parented content support instance.
        Parameters:
        parent - content filters parent
        eventListener - event listener
      • MessageBodyContext

        protected MessageBodyContext​(MessageBodyContext parent)
        Create a new parented content support instance.
        Parameters:
        parent - content filters parent
    • Method Detail

      • charset

        public abstract Charset charset()
                                 throws IllegalStateException
        Derive the charset to use from the Content-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 the Content-Type header value
      • registerFilter

        public MessageBodyContext registerFilter​(MessageBodyFilter filter)
        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 interface MessageBodyFilters
        Parameters:
        filter - a function to map previously registered or original Publisher to the new one. If returns null then the result will be ignored.
        Returns:
        this instance of MessageBodyFilters
        See Also:
        applyFilters(Flow.Publisher)
      • 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 publisher
        type - type information associated with the input publisher
        Returns:
        tail of the publisher chain