类 Netty4ClientHttpRequestFactory
- java.lang.Object
- org.springframework.http.client.Netty4ClientHttpRequestFactory
@Deprecated public class Netty4ClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory, InitializingBean, DisposableBean
已过时。as of Spring 5.0, in favor ofReactorClientHttpConnectorClientHttpRequestFactoryimplementation that uses Netty 4 to create requests.Allows to use a pre-configured
EventLoopGroupinstance: useful for sharing across multiple clients.Note that this implementation consistently closes the HTTP connection on each request.
- 从以下版本开始:
- 4.1.2
- 作者:
- Arjen Poutsma, Rossen Stoyanchev, Brian Clozel, Mark Paluch
字段概要
字段 修饰符和类型 字段 说明 static intDEFAULT_MAX_RESPONSE_SIZE已过时。The default maximum response size.
构造器概要
构造器 构造器 说明 Netty4ClientHttpRequestFactory()已过时。Create a newNetty4ClientHttpRequestFactorywith a defaultNioEventLoopGroup.Netty4ClientHttpRequestFactory(io.netty.channel.EventLoopGroup eventLoopGroup)已过时。Create a newNetty4ClientHttpRequestFactorywith the givenEventLoopGroup.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 voidafterPropertiesSet()已过时。Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected voidconfigureChannel(io.netty.channel.socket.SocketChannelConfig config)已过时。Template method for changing properties on the givenSocketChannelConfig.AsyncClientHttpRequestcreateAsyncRequest(URI uri, HttpMethod httpMethod)已过时。Create a new asynchronousAsyncClientHttpRequestfor the specified URI and HTTP method.ClientHttpRequestcreateRequest(URI uri, HttpMethod httpMethod)已过时。Create a newClientHttpRequestfor the specified URI and HTTP method.voiddestroy()已过时。Invoked by the containingBeanFactoryon destruction of a bean.voidsetConnectTimeout(int connectTimeout)已过时。Set the underlying connect timeout (in milliseconds).voidsetMaxResponseSize(int maxResponseSize)已过时。Set the default maximum response size.voidsetReadTimeout(int readTimeout)已过时。Set the underlying URLConnection's read timeout (in milliseconds).voidsetSslContext(io.netty.handler.ssl.SslContext sslContext)已过时。Set the SSL context.
字段详细资料
DEFAULT_MAX_RESPONSE_SIZE
public static final int DEFAULT_MAX_RESPONSE_SIZE
已过时。The default maximum response size.- 另请参阅:
setMaxResponseSize(int), 常量字段值
构造器详细资料
Netty4ClientHttpRequestFactory
public Netty4ClientHttpRequestFactory()
已过时。Create a newNetty4ClientHttpRequestFactorywith a defaultNioEventLoopGroup.
Netty4ClientHttpRequestFactory
public Netty4ClientHttpRequestFactory(io.netty.channel.EventLoopGroup eventLoopGroup)
已过时。Create a newNetty4ClientHttpRequestFactorywith the givenEventLoopGroup.NOTE: the given group will not be shutdown by this factory; doing so becomes the responsibility of the caller.
方法详细资料
setMaxResponseSize
public void setMaxResponseSize(int maxResponseSize)
已过时。Set the default maximum response size.By default this is set to
DEFAULT_MAX_RESPONSE_SIZE.- 从以下版本开始:
- 4.1.5
- 另请参阅:
HttpObjectAggregator(int)
setSslContext
public void setSslContext(io.netty.handler.ssl.SslContext sslContext)
已过时。Set the SSL context. When configured it is used to create and insert anSslHandlerin the channel pipeline.A default client SslContext is configured if none has been provided.
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
已过时。Set the underlying connect timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.- 另请参阅:
ChannelConfig.setConnectTimeoutMillis(int)
setReadTimeout
public void setReadTimeout(int readTimeout)
已过时。Set the underlying URLConnection's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.- 另请参阅:
ReadTimeoutHandler
afterPropertiesSet
public void afterPropertiesSet()
已过时。从接口复制的说明:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet在接口中InitializingBean
createRequest
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException
已过时。从接口复制的说明:ClientHttpRequestFactoryCreate a newClientHttpRequestfor the specified URI and HTTP method.The returned request can be written to, and then executed by calling
ClientHttpRequest.execute().- 指定者:
createRequest在接口中ClientHttpRequestFactory- 参数:
uri- the URI to create a request forhttpMethod- the HTTP method to execute- 返回:
- the created request
- 抛出:
IOException- in case of I/O errors
createAsyncRequest
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException
已过时。从接口复制的说明:AsyncClientHttpRequestFactoryCreate a new asynchronousAsyncClientHttpRequestfor the specified URI and HTTP method.The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync().- 指定者:
createAsyncRequest在接口中AsyncClientHttpRequestFactory- 参数:
uri- the URI to create a request forhttpMethod- the HTTP method to execute- 返回:
- the created request
- 抛出:
IOException- in case of I/O errors
configureChannel
protected void configureChannel(io.netty.channel.socket.SocketChannelConfig config)
已过时。Template method for changing properties on the givenSocketChannelConfig.The default implementation sets the connect timeout based on the set property.
- 参数:
config- the channel configuration
destroy
public void destroy() throws InterruptedException
已过时。从接口复制的说明:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- 指定者:
destroy在接口中DisposableBean- 抛出:
InterruptedException