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 value)
Add a cookie with the given name and value.
|
ClientRequest.Builder |
cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
Copy the given cookies into the entity's cookies map.
|
ClientRequest.Builder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
ClientRequest.Builder |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
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.Builder
header
in interface ClientRequest.Builder
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
public ClientRequest.Builder headers(HttpHeaders headers)
ClientRequest.Builder
headers
in interface ClientRequest.Builder
headers
- the existing HttpHeaders to copy frompublic ClientRequest.Builder cookie(java.lang.String name, java.lang.String value)
ClientRequest.Builder
cookie
in interface ClientRequest.Builder
name
- the cookie namevalue
- the cookie valuepublic ClientRequest.Builder cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
ClientRequest.Builder
cookies
in interface ClientRequest.Builder
cookies
- the existing cookies to copy frompublic <S,P extends <any>> ClientRequest.Builder body(P publisher, java.lang.Class<S> elementClass)
ClientRequest.Builder
Publisher
and return it.body
in interface ClientRequest.Builder
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 publisherpublic ClientRequest.Builder body(BodyInserter<?,? super ClientHttpRequest> inserter)
ClientRequest.Builder
BodyInserter
.body
in interface ClientRequest.Builder
inserter
- the BodyInserter
that writes to the requestpublic ClientRequest build()
ClientRequest.Builder
build
in interface ClientRequest.Builder