org.springframework.web.reactive.function

Class BodyExtractors

  • java.lang.Object
    • org.springframework.web.reactive.function.BodyExtractors


  • public abstract class BodyExtractors
    extends java.lang.Object
    Static factory methods for BodyExtractor implementations.
    Since:
    5.0
    Author:
    Arjen Poutsma, Sebastien Deleuze, Rossen Stoyanchev, Brian Clozel
    • Constructor Detail

      • BodyExtractors

        public BodyExtractors()
    • Method Detail

      • toMono

        public static <T> BodyExtractor<reactor.core.publisher.Mono<T>,ReactiveHttpInputMessage> toMono(java.lang.Class<? extends T> elementClass)
        Extractor to decode the input content into Mono<T>.
        Type Parameters:
        T - the element type to decode to
        Parameters:
        elementClass - the class of the element type to decode to
        Returns:
        BodyExtractor for Mono<T>
      • toFlux

        public static <T> BodyExtractor<reactor.core.publisher.Flux<T>,ReactiveHttpInputMessage> toFlux(java.lang.Class<? extends T> elementClass)
        Extractor to decode the input content into Flux<T>.
        Type Parameters:
        T - the element type to decode to
        Parameters:
        elementClass - the class of the element type to decode to
        Returns:
        BodyExtractor for Flux<T>
      • toFormData

        public static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,java.lang.String>>,ReactiveHttpInputMessage> toFormData()
        Extractor to read form data into MultiValueMap<String, String>.

        As of 5.1 this method can also be used on the client side to read form data from a server response (e.g. OAuth).

        Returns:
        BodyExtractor for form data
      • toMultipartData

        public static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,Part>>,ServerHttpRequest> toMultipartData()
        Extractor to read multipart data into a MultiValueMap<String, Part>.
        Returns:
        BodyExtractor for multipart data
      • toParts

        public static BodyExtractor<reactor.core.publisher.Flux<Part>,ServerHttpRequest> toParts()
        Extractor to read multipart data into Flux<Part>.
        Returns:
        BodyExtractor for multipart request parts