spring-framework / org.springframework.http.client / Netty4ClientHttpRequestFactory

Netty4ClientHttpRequestFactory

open class Netty4ClientHttpRequestFactory : ClientHttpRequestFactory, AsyncClientHttpRequestFactory, InitializingBean, DisposableBean

org.springframework.http.client.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.

Author
Arjen Poutsma

Author
Rossen Stoyanchev

Author
Brian Clozel

Author
Mark Paluch

Since
4.1.2

Constructors

<init>

Netty4ClientHttpRequestFactory()

Create a new Netty4ClientHttpRequestFactory with a default NioEventLoopGroup.

Netty4ClientHttpRequestFactory(eventLoopGroup: EventLoopGroup)

Create a new Netty4ClientHttpRequestFactory with the given EventLoopGroup.

NOTE: the given group will not be shutdown by this factory; doing so becomes the responsibility of the caller.

Properties

DEFAULT_MAX_RESPONSE_SIZE

static val DEFAULT_MAX_RESPONSE_SIZE: Int

The default maximum response size.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

createAsyncRequest

open fun createAsyncRequest(uri: URI, httpMethod: HttpMethod): AsyncClientHttpRequest

createRequest

open fun createRequest(uri: URI, httpMethod: HttpMethod): ClientHttpRequest

destroy

open fun destroy(): Unit

setConnectTimeout

open fun setConnectTimeout(connectTimeout: Int): Unit

Set the underlying connect timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.

setMaxResponseSize

open fun setMaxResponseSize(maxResponseSize: Int): Unit

Set the default maximum response size.

By default this is set to #DEFAULT_MAX_RESPONSE_SIZE.

setReadTimeout

open fun setReadTimeout(readTimeout: Int): Unit

Set the underlying URLConnection's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.

setSslContext

open fun setSslContext(sslContext: SslContext): Unit

Set the SSL context. When configured it is used to create and insert an io.netty.handler.ssl.SslHandler in the channel pipeline.

A default client SslContext is configured if none has been provided.