class DefaultClientRequestBuilder extends java.lang.Object implements ClientRequest.Builder
ClientRequest.Builder.| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultClientRequestBuilder.BodyInserterRequest |
| Modifier and Type | Field and Description |
|---|---|
private MultiValueMap<java.lang.String,java.lang.String> |
cookies |
private HttpHeaders |
headers |
private BodyInserter<?,? super ClientHttpRequest> |
inserter |
private HttpMethod |
method |
private java.net.URI |
url |
| Constructor and Description |
|---|
DefaultClientRequestBuilder(HttpMethod method,
java.net.URI url) |
| Modifier and Type | Method and Description |
|---|---|
ClientRequest.Builder |
body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter. |
<S,P extends <any>> |
body(P publisher,
java.lang.Class<S> elementClass)
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.
|
private final HttpMethod method
private final java.net.URI url
private final HttpHeaders headers
private final MultiValueMap<java.lang.String,java.lang.String> cookies
private BodyInserter<?,? super ClientHttpRequest> inserter
public DefaultClientRequestBuilder(HttpMethod method, java.net.URI url)
public ClientRequest.Builder header(java.lang.String headerName, java.lang.String... headerValues)
ClientRequest.Builderheader in interface ClientRequest.BuilderheaderName - the header nameheaderValues - the header value(s)HttpHeaders.add(String, String)public ClientRequest.Builder headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
ClientRequest.BuilderHttpHeaders methods.headers in interface ClientRequest.BuilderheadersConsumer - a function that consumes the HttpHeaderspublic ClientRequest.Builder cookie(java.lang.String name, java.lang.String... values)
ClientRequest.Buildercookie in interface ClientRequest.Buildername - the cookie namevalues - the cookie value(s)public ClientRequest.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
ClientRequest.BuilderMultiValueMap methods.cookies in interface ClientRequest.BuildercookiesConsumer - a function that consumes the cookies mappublic <S,P extends <any>> ClientRequest.Builder body(P publisher, java.lang.Class<S> elementClass)
ClientRequest.BuilderPublisher and return it.body in interface ClientRequest.BuilderS - the type of the elements contained in the publisherP - the type of the Publisherpublisher - the Publisher to write to the requestelementClass - the class of elements contained in the publisherpublic ClientRequest.Builder body(BodyInserter<?,? super ClientHttpRequest> inserter)
ClientRequest.BuilderBodyInserter.body in interface ClientRequest.Builderinserter - the BodyInserter that writes to the requestpublic ClientRequest build()
ClientRequest.Builderbuild in interface ClientRequest.Builder