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 ClientHttpRequest> |
body()
Return the body inserter of this request.
|
MultiValueMap<String,String> |
cookies()
Return the cookies of this request.
|
static ClientRequest.Builder |
create(HttpMethod method,
URI url)
Create a request builder with the given method and url.
|
static ClientRequest.Builder |
from(ClientRequest other)
Create a builder with the method, URI, headers, and cookies of the given request.
|
HttpHeaders |
headers()
Return the headers of this request.
|
String |
logPrefix()
Return a log message prefix to use to correlate messages for this request.
|
HttpMethod |
method()
Return the HTTP method.
|
static ClientRequest.Builder |
method(HttpMethod method,
URI url)
Deprecated.
in favor of
create(HttpMethod, URI) |
URI |
url()
Return the request URI.
|
reactor.core.publisher.Mono<Void> |
writeTo(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()HttpMethod method()
URI url()
HttpHeaders headers()
MultiValueMap<String,String> cookies()
BodyInserter<?,? super ClientHttpRequest> body()
default Optional<Object> attribute(String name)
name - the attribute nameString logPrefix()
LOG_ID_ATTRIBUTE
along with some extra formatting so that the prefix can be conveniently
prepended with no further formatting no separators required.LOG_ID_ATTRIBUTE is not set.reactor.core.publisher.Mono<Void> writeTo(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 the method, URI, headers, and cookies from@Deprecated static ClientRequest.Builder method(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(HttpMethod method, URI url)
method - the HTTP method (GET, POST, etc)url - the url (as a URI instance)