Interface ClientRequest
public interface ClientRequest
Represents a typed, immutable, client-side HTTP request, as executed by the
 
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.
- Since:
- 5.0
- Author:
- Brian Clozel, Arjen Poutsma
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDefines a builder for a request.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionReturn the request attribute value if present.Return the attributes of this request.BodyInserter<?,? super ClientHttpRequest> body()Return the body inserter of this request.cookies()Return the cookies of this request.static ClientRequest.Buildercreate(HttpMethod method, URI url) Create a request builder with the given HTTP method and url.static ClientRequest.Builderfrom(ClientRequest other) Create a builder initialized with the HTTP method, url, headers, cookies, attributes, and body of the given request.headers()Return the headers of this request.Return consumer(s) configured to access to theClientHttpRequest.Return a log message prefix to use to correlate messages for this request.method()Return the HTTP method.static ClientRequest.Buildermethod(HttpMethod method, URI url) Deprecated.url()Return the request URI.reactor.core.publisher.Mono<Void>writeTo(ClientHttpRequest request, ExchangeStrategies strategies) Write this request to the givenClientHttpRequest.
- 
Field Details- 
LOG_ID_ATTRIBUTEName ofattributewhose value can be used to correlate log messages for this request. UselogPrefix()to obtain a consistently formatted prefix based on this attribute.- Since:
- 5.1
- See Also:
 
 
- 
- 
Method Details- 
methodHttpMethod method()Return the HTTP method.
- 
urlURI url()Return the request URI.
- 
headersHttpHeaders headers()Return the headers of this request.
- 
cookiesMultiValueMap<String,String> cookies()Return the cookies of this request.
- 
bodyBodyInserter<?,? super ClientHttpRequest> body()Return the body inserter of this request.
- 
attributeReturn the request attribute value if present.- Parameters:
- name- the attribute name
- Returns:
- the attribute value
 
- 
attributesReturn the attributes of this request.
- 
httpRequestReturn consumer(s) configured to access to theClientHttpRequest.- Since:
- 5.3
 
- 
logPrefixString logPrefix()Return a log message prefix to use to correlate messages for this request. The prefix is based on the value of the attributeLOG_ID_ATTRIBUTEsurrounded with "[" and "]".- Returns:
- the log message prefix or an empty String if the
 LOG_ID_ATTRIBUTEis not set.
- Since:
- 5.1
 
- 
writeToWrite this request to the givenClientHttpRequest.- Parameters:
- request- the client http request to write to
- strategies- the strategies to use when writing
- Returns:
- Mono<Void>to indicate when writing is complete
 
- 
fromCreate a builder initialized with the HTTP method, url, headers, cookies, attributes, and body of the given request.- Parameters:
- other- the request to copy from
- Returns:
- the builder instance
 
- 
methodDeprecated.in favor ofcreate(HttpMethod, URI)Create a builder with the given HTTP method and url.- Parameters:
- method- the HTTP method (GET, POST, etc)
- url- the url (as a URI instance)
- Returns:
- the created builder
 
- 
createCreate a request builder with the given HTTP method and url.- Parameters:
- method- the HTTP method (GET, POST, etc)
- url- the url (as a URI instance)
- Returns:
- the created builder
 
 
- 
create(HttpMethod, URI)