Package org.springframework.http.client
Class ReactorNettyClientRequestFactory
java.lang.Object
org.springframework.http.client.ReactorNettyClientRequestFactory
- All Implemented Interfaces:
ClientHttpRequestFactory
Reactor-Netty implementation of
ClientHttpRequestFactory
.- Since:
- 6.1
- Author:
- Arjen Poutsma
-
Constructor Summary
ConstructorDescriptionCreate a new instance of theReactorNettyClientRequestFactory
with a defaultHttpClient
that has compression enabled.ReactorNettyClientRequestFactory
(reactor.netty.http.client.HttpClient httpClient) Create a new instance of theReactorNettyClientRequestFactory
based on the givenHttpClient
. -
Method Summary
Modifier and TypeMethodDescriptioncreateRequest
(URI uri, HttpMethod httpMethod) Create a newClientHttpRequest
for the specified URI and HTTP method.void
setConnectTimeout
(int connectTimeout) Set the underlying connect timeout in milliseconds.void
setConnectTimeout
(Duration connectTimeout) Set the underlying connect timeout in milliseconds.void
setExchangeTimeout
(long exchangeTimeout) Set the timeout for the HTTP exchange in milliseconds.void
setExchangeTimeout
(Duration exchangeTimeout) Set the timeout for the HTTP exchange.void
setReadTimeout
(long readTimeout) Set the underlying read timeout in milliseconds.void
setReadTimeout
(Duration readTimeout) Set the underlying read timeout asDuration
.
-
Constructor Details
-
ReactorNettyClientRequestFactory
public ReactorNettyClientRequestFactory()Create a new instance of theReactorNettyClientRequestFactory
with a defaultHttpClient
that has compression enabled. -
ReactorNettyClientRequestFactory
public ReactorNettyClientRequestFactory(reactor.netty.http.client.HttpClient httpClient) Create a new instance of theReactorNettyClientRequestFactory
based on the givenHttpClient
.- Parameters:
httpClient
- the client to base on
-
-
Method Details
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) Set the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.Default is 30 seconds.
- See Also:
-
Transport.option(ChannelOption, Object)
ChannelOption.CONNECT_TIMEOUT_MILLIS
-
setConnectTimeout
Set the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.Default is 30 seconds.
- See Also:
-
Transport.option(ChannelOption, Object)
ChannelOption.CONNECT_TIMEOUT_MILLIS
-
setReadTimeout
public void setReadTimeout(long readTimeout) Set the underlying read timeout in milliseconds.Default is 10 seconds.
-
setReadTimeout
Set the underlying read timeout asDuration
.Default is 10 seconds.
-
setExchangeTimeout
public void setExchangeTimeout(long exchangeTimeout) Set the timeout for the HTTP exchange in milliseconds.Default is 30 seconds.
-
setExchangeTimeout
Set the timeout for the HTTP exchange.Default is 30 seconds.
-
createRequest
Description copied from interface:ClientHttpRequestFactory
Create a newClientHttpRequest
for the specified URI and HTTP method.The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.- Specified by:
createRequest
in interfaceClientHttpRequestFactory
- Parameters:
uri
- the URI to create a request forhttpMethod
- the HTTP method to execute- Returns:
- the created request
- Throws:
IOException
- in case of I/O errors
-