ReactorClientHttpConnector
@Deprecated public class Netty4ClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory, InitializingBean, DisposableBean
ClientHttpRequestFactory
implementation
that uses Netty 4 to create requests.
Allows to use a pre-configured EventLoopGroup
instance: useful for
sharing across multiple clients.
Note that this implementation consistently closes the HTTP connection on each request.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_RESPONSE_SIZE
Deprecated.
The default maximum response size.
|
Constructor and Description |
---|
Netty4ClientHttpRequestFactory()
Deprecated.
Create a new
Netty4ClientHttpRequestFactory with a default
NioEventLoopGroup . |
Netty4ClientHttpRequestFactory(io.netty.channel.EventLoopGroup eventLoopGroup)
Deprecated.
Create a new
Netty4ClientHttpRequestFactory with the given
EventLoopGroup . |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Deprecated.
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
protected void |
configureChannel(io.netty.channel.socket.SocketChannelConfig config)
Deprecated.
Template method for changing properties on the given
SocketChannelConfig . |
AsyncClientHttpRequest |
createAsyncRequest(URI uri,
HttpMethod httpMethod)
Deprecated.
Create a new asynchronous
AsyncClientHttpRequest for the specified URI
and HTTP method. |
ClientHttpRequest |
createRequest(URI uri,
HttpMethod httpMethod)
Deprecated.
Create a new
ClientHttpRequest for the specified URI and HTTP method. |
void |
destroy()
Deprecated.
Invoked by the containing
BeanFactory on destruction of a bean. |
void |
setConnectTimeout(int connectTimeout)
Deprecated.
Set the underlying connect timeout (in milliseconds).
|
void |
setMaxResponseSize(int maxResponseSize)
Deprecated.
Set the default maximum response size.
|
void |
setReadTimeout(int readTimeout)
Deprecated.
Set the underlying URLConnection's read timeout (in milliseconds).
|
void |
setSslContext(io.netty.handler.ssl.SslContext sslContext)
Deprecated.
Set the SSL context.
|
public static final int DEFAULT_MAX_RESPONSE_SIZE
setMaxResponseSize(int)
,
Constant Field Valuespublic Netty4ClientHttpRequestFactory()
Netty4ClientHttpRequestFactory
with a default
NioEventLoopGroup
.public Netty4ClientHttpRequestFactory(io.netty.channel.EventLoopGroup eventLoopGroup)
Netty4ClientHttpRequestFactory
with the given
EventLoopGroup
.
NOTE: the given group will not be shutdown by this factory; doing so becomes the responsibility of the caller.
public void setMaxResponseSize(int maxResponseSize)
By default this is set to DEFAULT_MAX_RESPONSE_SIZE
.
HttpObjectAggregator.HttpObjectAggregator(int)
public void setSslContext(io.netty.handler.ssl.SslContext sslContext)
SslHandler
in the channel pipeline.
A default client SslContext is configured if none has been provided.
public void setConnectTimeout(int connectTimeout)
ChannelConfig.setConnectTimeoutMillis(int)
public void setReadTimeout(int readTimeout)
ReadTimeoutHandler
public void afterPropertiesSet()
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, ApplicationContextAware
etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
afterPropertiesSet
in interface InitializingBean
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException
ClientHttpRequestFactory
ClientHttpRequest
for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.
createRequest
in interface ClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executeIOException
- in case of I/O errorspublic AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException
AsyncClientHttpRequestFactory
AsyncClientHttpRequest
for the specified URI
and HTTP method.
The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync()
.
createAsyncRequest
in interface AsyncClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executeIOException
- in case of I/O errorsprotected void configureChannel(io.netty.channel.socket.SocketChannelConfig config)
SocketChannelConfig
.
The default implementation sets the connect timeout based on the set property.
config
- the channel configurationpublic void destroy() throws InterruptedException
DisposableBean
BeanFactory
on destruction of a bean.destroy
in interface DisposableBean
InterruptedException