HttpClient#connect() is ultimately called.
Transfer-Encoding: chunked will be applied for those HTTP methods for which
a request body is expected. Content-Length provided via request headers
will disable Transfer-Encoding: chunked.
Examples:
HttpClient.create() .baseUrl("https://example.com") .get() .response() .block();HttpClient.create() .post() .uri("https://example.com") .send(Flux.just(bb1, bb2, bb3)) .responseSingle((res, content) -> Mono.just(res.status().code())) .block();HttpClient.create() .baseUri("https://example.com") .post() .send(ByteBufFlux.fromString(flux)) .responseSingle((res, content) -> Mono.just(res.status().code())) .block();
| Modifier and Type | Class and Description |
|---|---|
| public static interface | HttpClient.RedirectSendHandler
Marker interface for use with |
| public static interface | HttpClient.RequestSender
Allow a request body configuration before calling one of the terminal, |
| public static interface | HttpClient.ResponseReceiver<S extends HttpClient.
A response extractor for this configured |
| public static interface | |
| public static interface | |
| public static interface | HttpClient.WebsocketSender
Allow a request body configuration before calling one of the terminal, |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final String | |
| pack-priv static final String | |
| public static final String | |
| pack-priv static final String | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final HttpClient | Returns: the appropriate sending or receiving contracta default base url that can be fully sufficient for request or can
be used to prepend future baseUrl)UriConfiguration#uri calls.Configure URI to use for this request/response. |
| public final HttpClient | Returns: a newHttpClientif true GZip compression is enabled otherwise disabled (default: false) compressionEnabled)Specifies whether GZip compression is enabled. |
| public final HttpClient | Returns: a newHttpClienta cookie to append to the request(s) cookie)Apply cookies configuration. |
| public final HttpClient | Returns: a newHttpClientthe mono providing the cookieMono)HttpCookiePair to add before sendingApply cookies configuration emitted by the specified Mono before requesting. |
| public static HttpClient | |
| public static HttpClient | Returns: aHttpClientthe connectionProvider)ConnectionProvider to be usedPrepare an |
| public final HttpClient. | Returns: aRequestSender ready to prepare the content for responseHTTP DELETE to connect the |
| public final HttpClient | Returns: a newHttpClienttrue to disable disableRetry)retry once, false to enable itOption to disable |
| public final HttpClient | Returns: a newHttpClienta callback called when doAfterRequest)HttpClientRequest has been sentSetup a callback called when |
| public final HttpClient | Returns: a newHttpClienta callback called after doAfterResponseSuccess)HttpClientResponse has been fully received
and HttpClientState#RESPONSE_COMPLETED has been emitted.Setup a callback called after |
| public final HttpClient | Returns: a newHttpClienta consumer observing request failures doOnRequestError, BiConsumer<? super HttpClientResponse, ? super Throwable> a consumer observing response failures doOnResponseError)Setup a callback called when |
| public final HttpClient | Returns: a newHttpClienta callback called after doOnRedirect)HttpClientResponse headers have been received
and the request is about to be redirectedSetup a callback called after |
| public final HttpClient | Returns: a newHttpClienta callback called when doOnRequest)HttpClientRequest is about to be sentSetup a callback called when |
| public final HttpClient | Returns: a newHttpClienta consumer observing request failures doOnRequestError)Setup a callback called when |
| public final HttpClient | Returns: a newHttpClienta callback called after doOnResponse)HttpClientResponse headers have been receivedSetup a callback called after |
| public final HttpClient | Returns: a newHttpClienta consumer observing response failures doOnResponseError)Setup a callback called when |
| public final HttpClient | Returns: a newHttpClientthat returns true to enable auto-redirect support. predicate)Enables auto-redirect support if the passed
|
| public final HttpClient | Returns: a newHttpClientthat returns true to enable auto-redirect support. predicate, BiConsumer<HttpHeaders, HttpClientRequest> BiConsumer, invoked on redirects, after
the redirect request has been initialized, in order to apply further changes such as
add/remove headers and cookies; use HttpClientRequest#redirectedFrom() to
check the original and any number of subsequent redirect(s), including the one that
is in progress. The BiConsumer provides the headers from the previous request
and the current redirect request.Variant of |
| public final HttpClient | Returns: a newHttpClientthat returns true to enable auto-redirect support. predicate, Consumer<HttpClientRequest> redirect request consumer, invoked on redirects, after
the redirect request has been initialized, in order to apply further changes such as
add/remove headers and cookies; use redirectRequestConsumer)HttpClientRequest#redirectedFrom() to
check the original and any number of subsequent redirect(s), including the one that
is in progress.Variant of |
| public final HttpClient | Returns: a newHttpClientif true HTTP status 301|302|307|308 auto-redirect support
is enabled, otherwise disabled (default: false). followRedirect)Specifies whether HTTP status 301|302|303|307|308 auto-redirect support is enabled. |
| public final HttpClient | Returns: a newHttpClientif true HTTP status 301|302|307|308 auto-redirect support
is enabled, otherwise disabled (default: false). followRedirect, BiConsumer<HttpHeaders, HttpClientRequest> BiConsumer, invoked on redirects, after
the redirect request has been initialized, in order to apply further changes such as
add/remove headers and cookies; use HttpClientRequest#redirectedFrom() to
check the original and any number of subsequent redirect(s), including the one that
is in progress. The BiConsumer provides the headers from the previous request
and the current redirect request.Variant of |
| public final HttpClient | Returns: a newHttpClientif true HTTP status 301|302|307|308 auto-redirect support
is enabled, otherwise disabled (default: false). followRedirect, Consumer<HttpClientRequest> redirect request consumer, invoked on redirects, after
the redirect request has been initialized, in order to apply further changes such as
add/remove headers and cookies; use redirectRequestConsumer)HttpClientRequest#redirectedFrom() to
check the original and any number of subsequent redirect(s), including the one that
is in progress.Variant of |
| public final HttpClient. | |
| public final HttpClient. | |
| public final HttpClient | Returns: a newHttpClientthe header headerBuilder)Consumer to invoke before requestingApply headers configuration. |
| public final HttpClient | Returns: a newHttpClientthe header headerBuilder)Function to invoke before sendingApply headers configuration emitted by the returned Mono before requesting. |
| public final HttpClient | Returns: a newHttpClientconfigures http2SettingsHttp2SettingsSpec before requestingApply HTTP/2 configuration |
| public final HttpClient | Returns: a newHttpClientthe factory for generating the log message httpMessageLogFactory)When |
| public final HttpClient | Returns: a newHttpClienta function to mutate the provided Http response decoder options responseDecoderOptions)Configure the |
| pack-priv static boolean | |
| public final HttpClient | Returns: a newHttpClienttrue if keepAlive should be enabled (default: true) keepAlive)Enable or Disable Keep-Alive support for the outgoing request. |
| public final HttpClient | Returns: a newHttpClientA bi function mapping the default connection and configured
bootstrap to a target connection. connector)Intercept the connection lifecycle and allows delaying, transform or inject a context. |
| public final HttpClient | Returns: a newHttpClienttrue enables metrics collection; false disables it enable, Function<String, String> a function that receives the actual uri and returns the uri tag value
that will be used for the metrics with uriTagValue)reactor. tagWhether to enable metrics to be collected and registered in Micrometer's
|
| public final HttpClient | metrics(boolean
if true enables the metrics on the enable, Supplier<? extends ChannelMetricsRecorder> Transport.a supplier for the recorder)ChannelMetricsRecorderOverrides reactor. Transport.
|
| public final HttpClient | Returns: a newHttpClienttrue enables metrics collection; false disables it enable, Supplier<? extends ChannelMetricsRecorder> a supplier for the metrics recorder that receives the collected metrics recorder, Function<String, String> a function that receives the actual uri and returns the uri value
that will be used when the metrics are propagated to the recorder. uriValue)Specifies whether the metrics are enabled on the |
| public static HttpClient | |
| public final HttpClient | |
| public final HttpClient | observe(ConnectionObserver
the observer)ConnectionObserver to be set or addOverrides reactor. ConnectionObserver to observe the connection state changes.
|
| public final HttpClient. | Returns: aRequestSender ready to consume for responseHTTP OPTIONS to connect the |
| public final HttpClient. | Returns: aRequestSender ready to finalize request and consume for responseHTTP PATCH to connect the |
| public final HttpClient | port(int
the port to connect to port)
The port to which this client should connect.
|
| public final HttpClient. | Returns: aRequestSender ready to finalize request and consume for responseHTTP POST to connect the |
| public final HttpClient | Returns: a newHttpClientThe various supportedProtocols)HttpProtocol this client will supportThe HTTP protocol to support. |
| protected ProxyProvider | proxyProviderFrom(Consumer<? super ProxyProvider.
Overrides reactor. |
| protected ProxyProvider | proxyProviderFrom(Properties properties)
Overrides reactor. |
| public final HttpClient. | Returns: aRequestSender ready to finalize request and consume for responseHTTP PUT to connect the |
| pack-priv static String | |
| public final HttpClient | remoteAddress(Supplier<? extends SocketAddress>
A supplier of the address to connect to. remoteAddressSupplier)Overrides reactor. |
| public HttpClient. | Returns: aRequestSender ready to finalize request and consume for responsethe HTTP method to send method)Use the passed HTTP method to connect the |
| public final HttpClient | Returns: a newHttpClientthe maximum duration allowed between each network-level read operations
(resolution: ms). maxReadOperationInterval)Specifies the maximum duration allowed between each network-level read operation while reading a given response (resolution: ms). |
| public final HttpClient | |
| public final HttpClient | Returns: a newHttpClientbuilder callback for further customization of SslContext. sslProviderBuilder)Apply an SSL configuration customization via the passed builder. |
| public HttpClient | Returns: a newHttpClientThe provider to set when configuring SSL sslProvider)Apply an SSL configuration via the passed |
| public Mono | Returns: aMono representing the completion of the warmupOverrides reactor. Mono that triggers:
|
| public final HttpClient. | Returns: aWebsocketSender ready to consume for responseHTTP Websocket to connect the |
| public final HttpClient. | Returns: aWebsocketSender ready to consume for responseWebsocketClientSpec for websocket configurationHTTP Websocket to connect the |
| public final HttpClient | wiretap(boolean
specifies whether the wire logger configuration will be added to the pipeline enable)Overrides reactor. Transport category (logger),
DEBUG logger level and AdvancedBufferFormat#HEX_DUMP for Buffer format,
which means both events and content will be logged and the content will be in hex format.
|