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<DataBuffer>,ReactiveHttpInputMessage> |
toDataBuffers()
|
static <T> BodyExtractor<reactor.core.publisher.Flux<T>,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>,ReactiveHttpInputMessage> |
toFlux(ParameterizedTypeReference<T> typeReference)
Return a
BodyExtractor that reads into a Reactor Flux . |
static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,java.lang.String>>,ServerHttpRequest> |
toFormData()
Return a
BodyExtractor that reads form data into a MultiValueMap . |
static <T> BodyExtractor<reactor.core.publisher.Mono<T>,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>,ReactiveHttpInputMessage> |
toMono(ParameterizedTypeReference<T> typeReference)
Return a
BodyExtractor that reads into a Reactor Mono . |
static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,Part>>,ServerHttpRequest> |
toMultipartData()
Return a
BodyExtractor that reads multipart (i.e. |
static BodyExtractor<reactor.core.publisher.Flux<Part>,ServerHttpRequest> |
toParts()
Return a
BodyExtractor that reads multipart (i.e. |
public static <T> BodyExtractor<reactor.core.publisher.Mono<T>,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 Mono
BodyExtractor
that reads a monopublic static <T> BodyExtractor<reactor.core.publisher.Mono<T>,ReactiveHttpInputMessage> toMono(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 Mono
BodyExtractor
that reads a monopublic static <T> BodyExtractor<reactor.core.publisher.Flux<T>,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 Flux
BodyExtractor
that reads a fluxpublic static <T> BodyExtractor<reactor.core.publisher.Flux<T>,ReactiveHttpInputMessage> toFlux(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 Flux
BodyExtractor
that reads a fluxpublic static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,java.lang.String>>,ServerHttpRequest> toFormData()
BodyExtractor
that reads form data into a MultiValueMap
.BodyExtractor
that reads form datapublic static BodyExtractor<reactor.core.publisher.Mono<MultiValueMap<java.lang.String,Part>>,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<Part>,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<DataBuffer>,ReactiveHttpInputMessage> toDataBuffers()
BodyExtractor
that returns the body of the message as a Flux
of
DataBuffer
s.
Note that the returned buffers should be released after usage by calling
DataBufferUtils.release(DataBuffer)
BodyExtractor
that returns the bodyReactiveHttpInputMessage.getBody()