public abstract class BodyExtractors
extends java.lang.Object
BodyExtractor that read various bodies, such a reactive streams.| Constructor and Description |
|---|
BodyExtractors() |
| Modifier and Type | Method and Description |
|---|---|
static BodyExtractor<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,org.springframework.http.ReactiveHttpInputMessage> |
toDataBuffers()
Return a
BodyExtractor that returns the body of the message as a Flux of
DataBuffers. |
static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> |
toFlux(java.lang.Class<? extends T> elementClass)
Return a
BodyExtractor that reads into a Reactor Flux. |
static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> |
toFlux(org.springframework.core.ParameterizedTypeReference<T> typeReference)
Return a
BodyExtractor that reads into a Reactor Flux. |
static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<java.lang.String,java.lang.String>>,org.springframework.http.server.reactive.ServerHttpRequest> |
toFormData()
Return a
BodyExtractor that reads form data into a MultiValueMap. |
static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> |
toMono(java.lang.Class<? extends T> elementClass)
Return a
BodyExtractor that reads into a Reactor Mono. |
static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> |
toMono(org.springframework.core.ParameterizedTypeReference<T> typeReference)
Return a
BodyExtractor that reads into a Reactor Mono. |
static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<java.lang.String,org.springframework.http.codec.multipart.Part>>,org.springframework.http.server.reactive.ServerHttpRequest> |
toMultipartData()
Return a
BodyExtractor that reads multipart (i.e. |
static BodyExtractor<reactor.core.publisher.Flux<org.springframework.http.codec.multipart.Part>,org.springframework.http.server.reactive.ServerHttpRequest> |
toParts()
Return a
BodyExtractor that reads multipart (i.e. |
public static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> toMono(java.lang.Class<? extends T> elementClass)
BodyExtractor that reads into a Reactor Mono.T - the element typeelementClass - the class of element in the MonoBodyExtractor that reads a monopublic static <T> BodyExtractor<reactor.core.publisher.Mono<T>,org.springframework.http.ReactiveHttpInputMessage> toMono(org.springframework.core.ParameterizedTypeReference<T> typeReference)
BodyExtractor that reads into a Reactor Mono.
The given ParameterizedTypeReference is used to pass generic type information, for
instance when using the WebClient
Mono<Map<String, String>> body = this.webClient
.get()
.uri("http://example.com")
.exchange()
.flatMap(r -> r.body(toMono(new ParameterizedTypeReference<Map<String,String>>() {})));
T - the element typetypeReference - a reference to the type of element in the MonoBodyExtractor that reads a monopublic static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> toFlux(java.lang.Class<? extends T> elementClass)
BodyExtractor that reads into a Reactor Flux.T - the element typeelementClass - the class of element in the FluxBodyExtractor that reads a fluxpublic static <T> BodyExtractor<reactor.core.publisher.Flux<T>,org.springframework.http.ReactiveHttpInputMessage> toFlux(org.springframework.core.ParameterizedTypeReference<T> typeReference)
BodyExtractor that reads into a Reactor Flux.
The given ParameterizedTypeReference is used to pass generic type information, for
instance when using the WebClient
Flux<ServerSentEvent<String>> body = this.webClient
.get()
.uri("http://example.com")
.exchange()
.flatMap(r -> r.body(toFlux(new ParameterizedTypeReference<ServerSentEvent<String>>() {})));
T - the element typetypeReference - a reference to the type of element in the FluxBodyExtractor that reads a fluxpublic static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<java.lang.String,java.lang.String>>,org.springframework.http.server.reactive.ServerHttpRequest> toFormData()
BodyExtractor that reads form data into a MultiValueMap.BodyExtractor that reads form datapublic static BodyExtractor<reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<java.lang.String,org.springframework.http.codec.multipart.Part>>,org.springframework.http.server.reactive.ServerHttpRequest> toMultipartData()
BodyExtractor that reads multipart (i.e. file upload) form data into a
MultiValueMap.BodyExtractor that reads multipart datapublic static BodyExtractor<reactor.core.publisher.Flux<org.springframework.http.codec.multipart.Part>,org.springframework.http.server.reactive.ServerHttpRequest> toParts()
BodyExtractor that reads multipart (i.e. file upload) form data into a
MultiValueMap.BodyExtractor that reads multipart datapublic static BodyExtractor<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,org.springframework.http.ReactiveHttpInputMessage> toDataBuffers()
BodyExtractor that returns the body of the message as a Flux of
DataBuffers.
Note that the returned buffers should be released after usage by calling
DataBufferUtils.release(DataBuffer)
BodyExtractor that returns the bodyReactiveHttpInputMessage.getBody()