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 java.lang.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 java.util.Optional<java.lang.Object> |
attribute(java.lang.String name)
Return the request attribute value if present.
|
java.util.Map<java.lang.String,java.lang.Object> |
attributes()
Return the attributes of this request.
|
BodyInserter<?,? super ClientHttpRequest> |
body()
Return the body inserter of this request.
|
MultiValueMap<java.lang.String,java.lang.String> |
cookies()
Return the cookies of this request.
|
static ClientRequest.Builder |
create(HttpMethod method,
java.net.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.
|
java.lang.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,
java.net.URI url)
Deprecated.
in favor of
create(HttpMethod, URI) |
java.net.URI |
url()
Return the request URI.
|
reactor.core.publisher.Mono<java.lang.Void> |
writeTo(ClientHttpRequest request,
ExchangeStrategies strategies)
Writes this request to the given
ClientHttpRequest . |
static final java.lang.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()
java.net.URI url()
HttpHeaders headers()
MultiValueMap<java.lang.String,java.lang.String> cookies()
BodyInserter<?,? super ClientHttpRequest> body()
default java.util.Optional<java.lang.Object> attribute(java.lang.String name)
name
- the attribute namejava.util.Map<java.lang.String,java.lang.Object> attributes()
java.lang.String 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<java.lang.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, java.net.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, java.net.URI url)
method
- the HTTP method (GET, POST, etc)url
- the url (as a URI instance)