public interface ClientRequest
ExchangeFunction
. Instances of this interface can be created via static
builder methods.
Note that applications are more likely to perform requests through
WebClient
rather than using this directly.
Modifier and Type | Interface and Description |
---|---|
static interface |
ClientRequest.Builder
Defines a builder for a request.
|
Modifier and Type | Field and Description |
---|---|
static String |
LOG_ID_ATTRIBUTE
Name of
attribute whose value can be used to
correlate log messages for this request. |
Modifier and Type | Method and Description |
---|---|
default Optional<Object> |
attribute(String name)
Return the request attribute value if present.
|
Map<String,Object> |
attributes()
Return the attributes of this request.
|
BodyInserter<?,? super org.springframework.http.client.reactive.ClientHttpRequest> |
body()
Return the body inserter of this request.
|
org.springframework.util.MultiValueMap<String,String> |
cookies()
Return the cookies of this request.
|
static ClientRequest.Builder |
create(org.springframework.http.HttpMethod method,
URI url)
Create a request builder with the given HTTP method and url.
|
static ClientRequest.Builder |
from(ClientRequest other)
Create a builder initialized with the HTTP method, url, headers, cookies,
attributes, and body of the given request.
|
org.springframework.http.HttpHeaders |
headers()
Return the headers of this request.
|
Consumer<org.springframework.http.client.reactive.ClientHttpRequest> |
httpRequest()
Return consumer(s) configured to access to the
ClientHttpRequest . |
String |
logPrefix()
Return a log message prefix to use to correlate messages for this request.
|
org.springframework.http.HttpMethod |
method()
Return the HTTP method.
|
static ClientRequest.Builder |
method(org.springframework.http.HttpMethod method,
URI url)
Deprecated.
in favor of
create(HttpMethod, URI) |
URI |
url()
Return the request URI.
|
reactor.core.publisher.Mono<Void> |
writeTo(org.springframework.http.client.reactive.ClientHttpRequest request,
ExchangeStrategies strategies)
Write this request to the given
ClientHttpRequest . |
static final String LOG_ID_ATTRIBUTE
attribute
whose value can be used to
correlate log messages for this request. Use logPrefix()
to
obtain a consistently formatted prefix based on this attribute.logPrefix()
org.springframework.http.HttpMethod method()
URI url()
org.springframework.http.HttpHeaders headers()
org.springframework.util.MultiValueMap<String,String> cookies()
BodyInserter<?,? super org.springframework.http.client.reactive.ClientHttpRequest> body()
default Optional<Object> attribute(String name)
name
- the attribute name@Nullable Consumer<org.springframework.http.client.reactive.ClientHttpRequest> httpRequest()
ClientHttpRequest
.String logPrefix()
LOG_ID_ATTRIBUTE
surrounded with "[" and "]".LOG_ID_ATTRIBUTE
is not set.reactor.core.publisher.Mono<Void> writeTo(org.springframework.http.client.reactive.ClientHttpRequest request, ExchangeStrategies strategies)
ClientHttpRequest
.request
- the client http request to write tostrategies
- the strategies to use when writingMono<Void>
to indicate when writing is completestatic ClientRequest.Builder from(ClientRequest other)
other
- the request to copy from@Deprecated static ClientRequest.Builder method(org.springframework.http.HttpMethod method, URI url)
create(HttpMethod, URI)
method
- the HTTP method (GET, POST, etc)url
- the url (as a URI instance)static ClientRequest.Builder create(org.springframework.http.HttpMethod method, URI url)
method
- the HTTP method (GET, POST, etc)url
- the url (as a URI instance)