public static interface ClientRequest.Builder
Modifier and Type | Method and Description |
---|---|
ClientRequest.Builder |
attribute(java.lang.String name,
java.lang.Object value)
Set the attribute with the given name to the given value.
|
ClientRequest.Builder |
attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Manipulate the request attributes with the given consumer.
|
ClientRequest.Builder |
body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter . |
<S,P extends org.reactivestreams.Publisher<S>> |
body(P publisher,
java.lang.Class<S> elementClass)
Set the body of the request to the given
Publisher and return it. |
<S,P extends org.reactivestreams.Publisher<S>> |
body(P publisher,
ParameterizedTypeReference<S> typeReference)
Set the body of the request to the given
Publisher and return it. |
ClientRequest |
build()
Builds the request entity with no body.
|
ClientRequest.Builder |
cookie(java.lang.String name,
java.lang.String... values)
Add a cookie with the given name and value(s).
|
ClientRequest.Builder |
cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.
|
ClientRequest.Builder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header value(s) under the given name.
|
ClientRequest.Builder |
headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate this request's headers with the given consumer.
|
ClientRequest.Builder |
method(HttpMethod method)
Set the method of the request.
|
ClientRequest.Builder |
url(java.net.URI url)
Set the url of the request.
|
ClientRequest.Builder method(HttpMethod method)
method
- the new methodClientRequest.Builder url(java.net.URI url)
url
- the new urlClientRequest.Builder header(java.lang.String headerName, java.lang.String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
ClientRequest.Builder headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
ClientRequest.Builder cookie(java.lang.String name, java.lang.String... values)
name
- the cookie namevalues
- the cookie value(s)ClientRequest.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
MultiValueMap
methods.cookiesConsumer
- a function that consumes the cookies mapClientRequest.Builder body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserter
.inserter
- the BodyInserter
that writes to the request<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher, java.lang.Class<S> elementClass)
Publisher
and return it.S
- 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 publisher<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher, ParameterizedTypeReference<S> typeReference)
Publisher
and return it.S
- the type of the elements contained in the publisherP
- the type of the Publisher
publisher
- the Publisher
to write to the requesttypeReference
- a type reference describing the elements contained in the publisherClientRequest.Builder attribute(java.lang.String name, java.lang.Object value)
name
- the name of the attribute to addvalue
- the value of the attribute to addClientRequest.Builder attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
attributesConsumer
- a function that consumes the attributesClientRequest build()