public static interface WebClient.HeaderSpec
Modifier and Type | Method and Description |
---|---|
WebClient.HeaderSpec |
accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
WebClient.HeaderSpec |
acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Set the list of acceptable charsets, as specified
by the
Accept-Charset header. |
WebClient.HeaderSpec |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
WebClient.HeaderSpec |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
WebClient.HeaderSpec |
cookie(java.lang.String name,
java.lang.String value)
Add a cookie with the given name and value.
|
WebClient.HeaderSpec |
cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
Copy the given cookies into the entity's cookies map.
|
<any> |
exchange()
Perform the request without a request body.
|
<T> <any> |
exchange(BodyInserter<T,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter and
perform the request. |
<T,S extends <any>> |
exchange(S publisher,
java.lang.Class<T> elementClass)
Set the body of the request to the given
Publisher and
perform the request. |
WebClient.HeaderSpec |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
WebClient.HeaderSpec |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
WebClient.HeaderSpec |
ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
Set the value of the
If-Modified-Since header. |
WebClient.HeaderSpec |
ifNoneMatch(java.lang.String... ifNoneMatches)
Set the values of the
If-None-Match header. |
WebClient.HeaderSpec accept(MediaType... acceptableMediaTypes)
Accept
header.acceptableMediaTypes
- the acceptable media typesWebClient.HeaderSpec acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Accept-Charset
header.acceptableCharsets
- the acceptable charsetsWebClient.HeaderSpec contentLength(long contentLength)
Content-Length
header.contentLength
- the content lengthHttpHeaders.setContentLength(long)
WebClient.HeaderSpec contentType(MediaType contentType)
Content-Type
header.contentType
- the content typeHttpHeaders.setContentType(MediaType)
WebClient.HeaderSpec cookie(java.lang.String name, java.lang.String value)
name
- the cookie namevalue
- the cookie valueWebClient.HeaderSpec cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
cookies
- the existing cookies to copy fromWebClient.HeaderSpec ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
If-Modified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
ifModifiedSince
- the new value of the headerWebClient.HeaderSpec ifNoneMatch(java.lang.String... ifNoneMatches)
If-None-Match
header.ifNoneMatches
- the new value of the headerWebClient.HeaderSpec header(java.lang.String headerName, java.lang.String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)WebClient.HeaderSpec headers(HttpHeaders headers)
headers
- the existing headers to copy from<any> exchange()
Mono
with the response<T> <any> exchange(BodyInserter<T,? super ClientHttpRequest> inserter)
BodyInserter
and
perform the request.T
- the type contained in the bodyinserter
- the BodyInserter
that writes to the requestMono
with the response<T,S extends <any>> <any> exchange(S publisher, java.lang.Class<T> elementClass)
Publisher
and
perform the request.T
- the type of the elements contained in the publisherS
- the type of the Publisher
publisher
- the Publisher
to write to the requestelementClass
- the class of elements contained in the publisherMono
with the response