Class MessageBodyReaderContext

    • Method Detail

      • create

        public static MessageBodyReaderContext create()
        Create a new empty reader context backed by empty read-only headers. Such reader context is typically the parent context that is used to hold application wide readers and inbound filters.
        Returns:
        MessageBodyWriterContext
      • registerReader

        @Deprecated
        public <T> void registerReader​(Class<T> type,
                                       Reader<T> reader)
        Deprecated.
        since 2.0.0 use registerReader(MessageBodyReader) instead
        Register a reader function with the given type.
        Type Parameters:
        T - supported type
        Parameters:
        type - class representing the supported type
        reader - reader function
      • registerReader

        @Deprecated
        public <T> void registerReader​(Predicate<Class<?>> predicate,
                                       Reader<T> reader)
        Deprecated.
        since 2.0.0 use registerReader(MessageBodyReader) instead
        Register a reader function with the type predicate.
        Type Parameters:
        T - supported type
        Parameters:
        predicate - class predicate
        reader - reader function
      • unmarshall

        public <T> Single<T> unmarshall​(Flow.Publisher<DataChunk> payload,
                                        GenericType<T> type)
        Convert a given HTTP payload into a publisher by selecting a reader that accepts the specified type and current context.
        Type Parameters:
        T - entity type
        Parameters:
        payload - inbound payload
        type - actual representation of the entity type
        Returns:
        publisher, never null
      • unmarshall

        public <T> Single<T> unmarshall​(Flow.Publisher<DataChunk> payload,
                                        MessageBodyReader<T> reader,
                                        GenericType<T> type)
        Convert a given HTTP payload into a publisher by selecting a reader with the specified class.
        Type Parameters:
        T - entity type
        Parameters:
        payload - inbound payload
        reader - specific reader
        type - actual representation of the entity type
        Returns:
        publisher, never null
      • unmarshallStream

        public <T> Flow.Publisher<T> unmarshallStream​(Flow.Publisher<DataChunk> payload,
                                                      GenericType<T> type)
        Convert a given HTTP payload into a publisher by selecting a stream reader that accepts the specified type and current context.
        Type Parameters:
        T - entity type
        Parameters:
        payload - inbound payload
        type - actual representation of the entity type
        Returns:
        publisher, never null
      • unmarshallStream

        public <T> Flow.Publisher<T> unmarshallStream​(Flow.Publisher<DataChunk> payload,
                                                      MessageBodyStreamReader<T> reader,
                                                      GenericType<T> type)
        Convert a given HTTP payload into a publisher by selecting a stream reader with the payload class.
        Type Parameters:
        T - entity type
        Parameters:
        payload - inbound payload
        reader - specific reader
        type - actual representation of the entity type
        Returns:
        publisher, never null
      • headers

        public ReadOnlyParameters headers()
        Get the underlying headers.
        Returns:
        Parameters, never null
      • contentType

        public Optional<MediaType> contentType()
        Get the Content-Type header.
        Returns:
        Optional, never null
      • create

        public static MessageBodyReaderContext create​(MediaContext mediaContext,
                                                      MessageBodyContext.EventListener eventListener,
                                                      ReadOnlyParameters headers,
                                                      Optional<MediaType> contentType)
        Create a new empty reader context backed by the specified headers.
        Parameters:
        mediaContext - mediaSupport instance used to derived the parent context, may be null
        eventListener - subscription event listener, may be null
        headers - backing headers, must not be null
        contentType - content type, must not be null
        Returns:
        MessageBodyReaderContext