接口的使用
org.springframework.web.reactive.function.BodyInserter
使用BodyInserter的程序包 程序包 说明 org.springframework.test.web.reactive.server Support for testing Spring WebFlux server endpoints viaWebTestClient
.org.springframework.web.reactive.function Provides a foundation for both the reactive client and server subpackages.org.springframework.web.reactive.function.client Provides a reactiveWebClient
that builds on top of theorg.springframework.http.client.reactive
reactive HTTP adapter layer.org.springframework.web.reactive.function.server Provides the types that make up Spring's functional web framework for Reactive environments.org.springframework.test.web.reactive.server中BodyInserter的使用
参数类型为BodyInserter的org.springframework.test.web.reactive.server中的方法 修饰符和类型 方法 说明 WebTestClient.RequestHeadersSpec<?>
WebTestClient.RequestBodySpec. body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the givenBodyInserter
.org.springframework.web.reactive.function中BodyInserter的使用
org.springframework.web.reactive.function中BodyInserter的子接口 修饰符和类型 接口 说明 static interface
BodyInserters.FormInserter<T>
Extension ofBodyInserter
that allows for adding form data or multipart form data.static interface
BodyInserters.MultipartInserter
Extension ofBodyInserters.FormInserter
that allows for adding asynchronous parts.返回BodyInserter的org.springframework.web.reactive.function中的方法 修饰符和类型 方法 说明 static <T> BodyInserter<T,ReactiveHttpOutputMessage>
BodyInserters. empty()
Inserter that does not write.static <T extends org.reactivestreams.Publisher<DataBuffer>>
BodyInserter<T,ReactiveHttpOutputMessage>BodyInserters. fromDataBuffers(T publisher)
Inserter to write the givenPublisher<DataBuffer>
to the body.static <T> BodyInserter<T,ReactiveHttpOutputMessage>
BodyInserters. fromObject(T body)
已过时。As of Spring Framework 5.2, in favor ofBodyInserters.fromValue(Object)
static <T> BodyInserter<T,ReactiveHttpOutputMessage>
BodyInserters. fromProducer(T producer, Class<?> elementClass)
Inserter to write the given producer of value(s) which must be aPublisher
or another producer adaptable to aPublisher
viaReactiveAdapterRegistry
.static <T> BodyInserter<T,ReactiveHttpOutputMessage>
BodyInserters. fromProducer(T producer, ParameterizedTypeReference<?> elementTypeRef)
Inserter to write the given producer of value(s) which must be aPublisher
or another producer adaptable to aPublisher
viaReactiveAdapterRegistry
.static <T,P extends org.reactivestreams.Publisher<T>>
BodyInserter<P,ReactiveHttpOutputMessage>BodyInserters. fromPublisher(P publisher, Class<T> elementClass)
Inserter to write the givenPublisher
.static <T,P extends org.reactivestreams.Publisher<T>>
BodyInserter<P,ReactiveHttpOutputMessage>BodyInserters. fromPublisher(P publisher, ParameterizedTypeReference<T> elementTypeRef)
Inserter to write the givenPublisher
.static <T extends Resource>
BodyInserter<T,ReactiveHttpOutputMessage>BodyInserters. fromResource(T resource)
Inserter to write the givenResource
.static <T,S extends org.reactivestreams.Publisher<ServerSentEvent<T>>>
BodyInserter<S,ServerHttpResponse>BodyInserters. fromServerSentEvents(S eventsPublisher)
Inserter to write the givenServerSentEvent
publisher.static <T> BodyInserter<T,ReactiveHttpOutputMessage>
BodyInserters. fromValue(T body)
Inserter to write the given value.org.springframework.web.reactive.function.client中BodyInserter的使用
返回BodyInserter的org.springframework.web.reactive.function.client中的方法 修饰符和类型 方法 说明 BodyInserter<?,? super ClientHttpRequest>
ClientRequest. body()
Return the body inserter of this request.参数类型为BodyInserter的org.springframework.web.reactive.function.client中的方法 修饰符和类型 方法 说明 ClientRequest.Builder
ClientRequest.Builder. body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the givenBodyInserter
.WebClient.RequestHeadersSpec<?>
WebClient.RequestBodySpec. body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request using the given body inserter.org.springframework.web.reactive.function.server中BodyInserter的使用
返回BodyInserter的org.springframework.web.reactive.function.server中的方法 修饰符和类型 方法 说明 BodyInserter<T,? super ServerHttpResponse>
EntityResponse. inserter()
Return theBodyInserter
that writes the entity to the output stream.参数类型为BodyInserter的org.springframework.web.reactive.function.server中的方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<ServerResponse>
ServerResponse.BodyBuilder. body(BodyInserter<?,? super ServerHttpResponse> inserter)
Set the body of the response to the givenBodyInserter
and return it.