public static interface WebClient.RequestBodySpec extends WebClient.RequestHeadersSpec<WebClient.RequestBodySpec>
Modifier and Type | Method and Description |
---|---|
WebClient.RequestHeadersSpec<?> |
body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter . |
<T,P extends org.reactivestreams.Publisher<T>> |
body(P publisher,
java.lang.Class<T> elementClass)
Set the body of the request to the given asynchronous
Publisher . |
<T,P extends org.reactivestreams.Publisher<T>> |
body(P publisher,
ParameterizedTypeReference<T> typeReference)
Set the body of the request to the given asynchronous
Publisher . |
WebClient.RequestBodySpec |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
WebClient.RequestBodySpec |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
WebClient.RequestHeadersSpec<?> |
syncBody(java.lang.Object body)
Set the body of the request to the given synchronous
Object . |
accept, acceptCharset, attribute, attributes, cookie, cookies, exchange, header, headers, ifModifiedSince, ifNoneMatch, retrieve
WebClient.RequestBodySpec contentLength(long contentLength)
Content-Length
header.contentLength
- the content lengthHttpHeaders.setContentLength(long)
WebClient.RequestBodySpec contentType(MediaType contentType)
Content-Type
header.contentType
- the content typeHttpHeaders.setContentType(MediaType)
WebClient.RequestHeadersSpec<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserter
.inserter
- the BodyInserter
that writes to the request<T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, ParameterizedTypeReference<T> typeReference)
Publisher
.
This method is a convenient shortcut for body(BodyInserter)
with a
BodyInserters.fromPublisher(P, java.lang.Class<T>)
Publisher body inserter}.
T
- the type of the elements contained in the publisherP
- the type of the Publisher
publisher
- the Publisher
to write to the requesttypeReference
- the type reference of elements contained in the publisher<T,P extends org.reactivestreams.Publisher<T>> WebClient.RequestHeadersSpec<?> body(P publisher, java.lang.Class<T> elementClass)
Publisher
.
This method is a convenient shortcut for body(BodyInserter)
with a
BodyInserters.fromPublisher(P, java.lang.Class<T>)
Publisher body inserter}.
T
- the type of the elements contained in the publisherP
- the type of the Publisher
publisher
- the Publisher
to write to the requestelementClass
- the class of elements contained in the publisherWebClient.RequestHeadersSpec<?> syncBody(java.lang.Object body)
Object
.
This method is a convenient shortcut for body(BodyInserter)
with a
Object body inserter.
body
- the Object
to write to the request