public static interface ClientRequest.Builder
Modifier and Type | Method and Description |
---|---|
ClientRequest.Builder |
attribute(String name,
Object value)
Set the attribute with the given name to the given value.
|
ClientRequest.Builder |
attributes(Consumer<Map<String,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,
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()
Build the request.
|
ClientRequest.Builder |
cookie(String name,
String... values)
Add a cookie with the given name and value(s).
|
ClientRequest.Builder |
cookies(Consumer<MultiValueMap<String,String>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.
|
ClientRequest.Builder |
header(String headerName,
String... headerValues)
Add the given header value(s) under the given name.
|
ClientRequest.Builder |
headers(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(URI url)
Set the url of the request.
|
ClientRequest.Builder method(HttpMethod method)
method
- the new methodClientRequest.Builder url(URI url)
url
- the new urlClientRequest.Builder header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
ClientRequest.Builder headers(Consumer<HttpHeaders> headersConsumer)
HttpHeaders
methods.headersConsumer
- a function that consumes the HttpHeaders
ClientRequest.Builder cookie(String name, String... values)
name
- the cookie namevalues
- the cookie value(s)ClientRequest.Builder cookies(Consumer<MultiValueMap<String,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, 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(String name, Object value)
name
- the name of the attribute to addvalue
- the value of the attribute to addClientRequest.Builder attributes(Consumer<Map<String,Object>> attributesConsumer)
attributesConsumer
- a function that consumes the attributesClientRequest build()