private class DefaultWebTestClient.DefaultRequestBodyUriSpec extends java.lang.Object implements WebTestClient.RequestBodyUriSpec
Modifier and Type | Field and Description |
---|---|
private WebClient.RequestBodyUriSpec |
bodySpec |
private java.lang.String |
requestId |
private java.lang.String |
uriTemplate |
Constructor and Description |
---|
DefaultRequestBodyUriSpec(WebClient.RequestBodyUriSpec spec) |
Modifier and Type | Method and Description |
---|---|
WebTestClient.RequestBodySpec |
accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
WebTestClient.RequestBodySpec |
acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Set the list of acceptable charsets, as specified
by the
Accept-Charset header. |
WebTestClient.RequestBodySpec |
attribute(java.lang.String name,
java.lang.Object value)
Set the attribute with the given name to the given value.
|
WebTestClient.RequestBodySpec |
attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Manipulate the request attributes with the given consumer.
|
WebTestClient.RequestHeadersSpec<?> |
body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter . |
<T,S extends <any>> |
body(S publisher,
java.lang.Class<T> elementClass)
Set the body of the request to the given asynchronous
Publisher . |
WebTestClient.RequestBodySpec |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
WebTestClient.RequestBodySpec |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
WebTestClient.RequestBodySpec |
cookie(java.lang.String name,
java.lang.String value)
Add a cookie with the given name and value.
|
WebTestClient.RequestBodySpec |
cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.
|
WebTestClient.ResponseSpec |
exchange()
Perform the exchange without a request body.
|
WebTestClient.RequestBodySpec |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
WebTestClient.RequestBodySpec |
headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate the request's headers with the given consumer.
|
WebTestClient.RequestBodySpec |
ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
Set the value of the
If-Modified-Since header. |
WebTestClient.RequestBodySpec |
ifNoneMatch(java.lang.String... ifNoneMatches)
Set the values of the
If-None-Match header. |
WebTestClient.RequestHeadersSpec<?> |
syncBody(java.lang.Object body)
Set the body of the request to the given synchronous
Object and
perform the request. |
WebTestClient.RequestBodySpec |
uri(java.util.function.Function<UriBuilder,java.net.URI> uriFunction)
Build the URI for the request with a
UriBuilder obtained
through the UriBuilderFactory configured for this client. |
WebTestClient.RequestBodySpec |
uri(java.lang.String uriTemplate,
java.util.Map<java.lang.String,?> uriVariables)
Specify the URI for the request using a URI template and URI variables.
|
WebTestClient.RequestBodySpec |
uri(java.lang.String uriTemplate,
java.lang.Object... uriVariables)
Specify the URI for the request using a URI template and URI variables.
|
WebTestClient.RequestBodySpec |
uri(java.net.URI uri)
Specify the URI using an absolute, fully constructed
URI . |
private final WebClient.RequestBodyUriSpec bodySpec
@Nullable private java.lang.String uriTemplate
private final java.lang.String requestId
DefaultRequestBodyUriSpec(WebClient.RequestBodyUriSpec spec)
public WebTestClient.RequestBodySpec uri(java.lang.String uriTemplate, java.lang.Object... uriVariables)
WebTestClient.UriSpec
UriBuilderFactory
was configured for the client (e.g.
with a base URI) it will be used to expand the URI template.uri
in interface WebTestClient.UriSpec<WebTestClient.RequestBodySpec>
public WebTestClient.RequestBodySpec uri(java.lang.String uriTemplate, java.util.Map<java.lang.String,?> uriVariables)
WebTestClient.UriSpec
UriBuilderFactory
was configured for the client (e.g.
with a base URI) it will be used to expand the URI template.uri
in interface WebTestClient.UriSpec<WebTestClient.RequestBodySpec>
public WebTestClient.RequestBodySpec uri(java.util.function.Function<UriBuilder,java.net.URI> uriFunction)
WebTestClient.UriSpec
UriBuilder
obtained
through the UriBuilderFactory
configured for this client.uri
in interface WebTestClient.UriSpec<WebTestClient.RequestBodySpec>
public WebTestClient.RequestBodySpec uri(java.net.URI uri)
WebTestClient.UriSpec
URI
.uri
in interface WebTestClient.UriSpec<WebTestClient.RequestBodySpec>
public WebTestClient.RequestBodySpec header(java.lang.String headerName, java.lang.String... headerValues)
WebTestClient.RequestHeadersSpec
header
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
headerName
- the header nameheaderValues
- the header value(s)public WebTestClient.RequestBodySpec headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
WebTestClient.RequestHeadersSpec
HttpHeaders
methods.headers
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
headersConsumer
- a function that consumes the HttpHeaders
public WebTestClient.RequestBodySpec attribute(java.lang.String name, java.lang.Object value)
WebTestClient.RequestHeadersSpec
attribute
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
name
- the name of the attribute to addvalue
- the value of the attribute to addpublic WebTestClient.RequestBodySpec attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
WebTestClient.RequestHeadersSpec
attributes
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
attributesConsumer
- a function that consumes the attributespublic WebTestClient.RequestBodySpec accept(MediaType... acceptableMediaTypes)
WebTestClient.RequestHeadersSpec
Accept
header.accept
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
acceptableMediaTypes
- the acceptable media typespublic WebTestClient.RequestBodySpec acceptCharset(java.nio.charset.Charset... acceptableCharsets)
WebTestClient.RequestHeadersSpec
Accept-Charset
header.acceptCharset
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
acceptableCharsets
- the acceptable charsetspublic WebTestClient.RequestBodySpec contentType(MediaType contentType)
WebTestClient.RequestBodySpec
Content-Type
header.contentType
in interface WebTestClient.RequestBodySpec
contentType
- the content typeHttpHeaders.setContentType(MediaType)
public WebTestClient.RequestBodySpec contentLength(long contentLength)
WebTestClient.RequestBodySpec
Content-Length
header.contentLength
in interface WebTestClient.RequestBodySpec
contentLength
- the content lengthHttpHeaders.setContentLength(long)
public WebTestClient.RequestBodySpec cookie(java.lang.String name, java.lang.String value)
WebTestClient.RequestHeadersSpec
cookie
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
name
- the cookie namevalue
- the cookie valuepublic WebTestClient.RequestBodySpec cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
WebTestClient.RequestHeadersSpec
MultiValueMap
methods.cookies
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
cookiesConsumer
- a function that consumes the cookies mappublic WebTestClient.RequestBodySpec ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
WebTestClient.RequestHeadersSpec
If-Modified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
ifModifiedSince
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
ifModifiedSince
- the new value of the headerpublic WebTestClient.RequestBodySpec ifNoneMatch(java.lang.String... ifNoneMatches)
WebTestClient.RequestHeadersSpec
If-None-Match
header.ifNoneMatch
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
ifNoneMatches
- the new value of the headerpublic WebTestClient.RequestHeadersSpec<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
WebTestClient.RequestBodySpec
BodyInserter
.body
in interface WebTestClient.RequestBodySpec
inserter
- the inserterBodyInserters
public <T,S extends <any>> WebTestClient.RequestHeadersSpec<?> body(S publisher, java.lang.Class<T> elementClass)
WebTestClient.RequestBodySpec
Publisher
.body
in interface WebTestClient.RequestBodySpec
T
- the type of the elements contained in the publisherS
- the type of the Publisher
publisher
- the request body dataelementClass
- the class of elements contained in the publisherpublic WebTestClient.RequestHeadersSpec<?> syncBody(java.lang.Object body)
WebTestClient.RequestBodySpec
Object
and
perform the request.syncBody
in interface WebTestClient.RequestBodySpec
body
- the Object
to write to the requestMono
with the responsepublic WebTestClient.ResponseSpec exchange()
WebTestClient.RequestHeadersSpec
exchange
in interface WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>