Class BodyExtractors

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

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static BodyExtractor<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,org.springframework.http.ReactiveHttpInputMessage>
    Extractor that returns the raw DataBuffers.
    static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage>
    toFlux(Class<? extends T> elementClass)
    Extractor to decode the input content into Flux<T>.
    static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage>
    toFlux(org.springframework.core.ParameterizedTypeReference<T> typeRef)
    Variant of toFlux(Class) for type information with generics.
    static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<String,String>>,org.springframework.http.ReactiveHttpInputMessage>
    Extractor to read form data into MultiValueMap<String, String>.
    static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage>
    toMono(Class<? extends T> elementClass)
    Extractor to decode the input content into Mono<T>.
    static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage>
    toMono(org.springframework.core.ParameterizedTypeReference<T> elementTypeRef)
    Variant of toMono(Class) for type information with generics.
    static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<String,org.springframework.http.codec.multipart.Part>>,org.springframework.http.server.reactive.ServerHttpRequest>
    Extractor to read multipart data into a MultiValueMap<String, Part>.
    static BodyExtractor<reactor.core.publisher.Flux<org.springframework.http.codec.multipart.Part>,org.springframework.http.server.reactive.ServerHttpRequest>
    Extractor to read multipart data into Flux<Part>.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BodyExtractors

      public BodyExtractors()
  • Method Details

    • toMono

      public static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> toMono(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>
    • toMono

      public static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> toMono(org.springframework.core.ParameterizedTypeReference<T> elementTypeRef)
      Variant of toMono(Class) for type information with generics.
      Type Parameters:
      T - the element type to decode to
      Parameters:
      elementTypeRef - the type reference for the type to decode to
      Returns:
      BodyExtractor for Mono<T>
    • toFlux

      public static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> toFlux(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>
    • toFlux

      public static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> toFlux(org.springframework.core.ParameterizedTypeReference<T> typeRef)
      Variant of toFlux(Class) for type information with generics.
      Type Parameters:
      T - the element type to decode to
      Parameters:
      typeRef - the type reference for the type to decode to
      Returns:
      BodyExtractor for Flux<T>
    • toFormData

      public static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<String,String>>,org.springframework.http.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<org.springframework.util.MultiValueMap<String,org.springframework.http.codec.multipart.Part>>,org.springframework.http.server.reactive.ServerHttpRequest> toMultipartData()
      Extractor to read multipart data into a MultiValueMap<String, Part>.

      Note: that resources used for part handling, like storage for the uploaded files, is not deleted automatically, but should be done via Part.delete().

      Returns:
      BodyExtractor for multipart data
    • toParts

      public static BodyExtractor<reactor.core.publisher.Flux<org.springframework.http.codec.multipart.Part>,org.springframework.http.server.reactive.ServerHttpRequest> toParts()
      Extractor to read multipart data into Flux<Part>.

      Note: that resources used for part handling, like storage for the uploaded files, is not deleted automatically, but should be done via Part.delete().

      Returns:
      BodyExtractor for multipart request parts
    • toDataBuffers

      public static BodyExtractor<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,org.springframework.http.ReactiveHttpInputMessage> toDataBuffers()
      Extractor that returns the raw DataBuffers.

      Note: the data buffers should be released after being used.

      Returns:
      BodyExtractor for data buffers