Package io.vertx.core.http
Class HttpClientOptions
- java.lang.Object
-
- io.vertx.core.net.NetworkOptions
-
- io.vertx.core.net.TCPSSLOptions
-
- io.vertx.core.net.ClientOptionsBase
-
- io.vertx.core.http.HttpClientOptions
-
- Direct Known Subclasses:
HttpSenderOptions,WebClientOptions
public class HttpClientOptions extends ClientOptionsBase
Options describing how anHttpClientwill make connections.- Author:
- Tim Fox
-
-
Field Summary
Fields Modifier and Type Field Description static List<HttpVersion>DEFAULT_ALPN_VERSIONSDefault Application-Layer Protocol Negotiation versions = [] (automatic according to protocol version)static intDEFAULT_DECODER_INITIAL_BUFFER_SIZEDefault initial buffer size for HttpObjectDecoder = 128 bytesstatic booleanDEFAULT_DECOMPRESSION_SUPPORTEDWhether the client should send requests with anaccepting-encodingheader set to a compression algorithm by default =falsestatic StringDEFAULT_DEFAULT_HOSTThe default value for host name = "localhost"static intDEFAULT_DEFAULT_PORTThe default value for port = 80static booleanDEFAULT_FORCE_SNIstatic booleanDEFAULT_HTTP2_CLEAR_TEXT_UPGRADEDefault using HTTP/1.1 upgrade for establishing an h2C connection =truestatic booleanDEFAULT_HTTP2_CLEAR_TEXT_UPGRADE_WITH_PREFLIGHT_REQUESTDefault to use a preflight OPTIONS request for h2C without prior knowledge connection =falsestatic intDEFAULT_HTTP2_CONNECTION_WINDOW_SIZEThe default connection window size for HTTP/2 = -1static intDEFAULT_HTTP2_KEEP_ALIVE_TIMEOUTThe default keep alive timeout for HTTP/2 connection can send = 60 secondsstatic intDEFAULT_HTTP2_MULTIPLEXING_LIMITThe default maximum number of concurrent streams per connection for HTTP/2 = -1static intDEFAULT_HTTP2_UPGRADE_MAX_CONTENT_LENGTHDefault maximum length of the aggregated content in bytesstatic booleanDEFAULT_KEEP_ALIVEDefault value of whether keep-alive is enabled =truestatic intDEFAULT_KEEP_ALIVE_TIMEOUTThe default keep alive timeout for HTTP/1.1 connection can send = 60 secondsstatic intDEFAULT_MAX_CHUNK_SIZEDefault max HTTP chunk size = 8192static intDEFAULT_MAX_HEADER_SIZEDefault max length of all headers = 8192static intDEFAULT_MAX_INITIAL_LINE_LENGTHDefault max length of the initial line (e.g.static intDEFAULT_MAX_REDIRECTSstatic StringDEFAULT_NAMEActual name of anonymous shared client =__vertx.DEFAULTstatic booleanDEFAULT_PIPELININGDefault value of whether pipe-lining is enabled =falsestatic intDEFAULT_PIPELINING_LIMITThe default maximum number of requests an HTTP/1.1 pipe-lined connection can send = 10static HttpVersionDEFAULT_PROTOCOL_VERSIONThe default protocol version = HTTP/1.1static booleanDEFAULT_SHAREDDefault shared client =falsestatic TracingPolicyDEFAULT_TRACING_POLICYDefault tracing control =TracingPolicy.PROPAGATEstatic booleanDEFAULT_VERIFY_HOSTDefault value of whether hostname verification (for SSL/TLS) is enabled =true-
Fields inherited from class io.vertx.core.net.ClientOptionsBase
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME
-
Fields inherited from class io.vertx.core.net.TCPSSLOptions
DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT
-
Fields inherited from class io.vertx.core.net.NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
-
-
Constructor Summary
Constructors Constructor Description HttpClientOptions()Default constructorHttpClientOptions(HttpClientOptions other)Copy constructorHttpClientOptions(JsonObject json)Constructor to create an options from JSONHttpClientOptions(ClientOptionsBase other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpClientOptionsaddCrlPath(String crlPath)Add a CRL pathHttpClientOptionsaddCrlValue(Buffer crlValue)Add a CRL valueHttpClientOptionsaddEnabledCipherSuite(String suite)Add an enabled cipher suite, appended to the ordered suites.HttpClientOptionsaddEnabledSecureTransportProtocol(String protocol)Add an enabled SSL/TLS protocols, appended to the ordered protocols.HttpClientOptionsaddNonProxyHost(String nonProxyHost)Add ahostto theClientOptionsBase.getNonProxyHosts()list.List<HttpVersion>getAlpnVersions()intgetDecoderInitialBufferSize()StringgetDefaultHost()Get the default host name to be used by this client in requests if none is provided when making the request.intgetDefaultPort()Get the default port to be used by this client in requests if none is provided when making the request.intgetHttp2ConnectionWindowSize()intgetHttp2KeepAliveTimeout()intgetHttp2MultiplexingLimit()intgetHttp2UpgradeMaxContentLength()Http2SettingsgetInitialSettings()intgetKeepAliveTimeout()intgetMaxChunkSize()Returns the maximum HTTP chunk sizeintgetMaxHeaderSize()intgetMaxInitialLineLength()intgetMaxRedirects()StringgetName()intgetPipeliningLimit()HttpVersiongetProtocolVersion()Get the protocol version.TracingPolicygetTracingPolicy()booleanisDecompressionSupported()booleanisForceSni()booleanisHttp2ClearTextUpgrade()booleanisHttp2ClearTextUpgradeWithPreflightRequest()booleanisKeepAlive()Is keep alive enabled on the client?booleanisPipelining()Is pipe-lining enabled on the clientbooleanisShared()booleanisVerifyHost()Is hostname verification (for SSL/TLS) enabled?HttpClientOptionsremoveEnabledCipherSuite(String suite)Removes an enabled cipher suite from the ordered suites.HttpClientOptionsremoveEnabledSecureTransportProtocol(String protocol)Removes an enabled SSL/TLS protocol from the ordered protocols.HttpClientOptionssetActivityLogDataFormat(ByteBufFormat activityLogDataFormat)Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.HttpClientOptionssetAlpnVersions(List<HttpVersion> alpnVersions)Set the list of protocol versions to provide to the server during the Application-Layer Protocol Negotiation.HttpClientOptionssetConnectTimeout(int connectTimeout)Set the connect timeoutHttpClientOptionssetDecoderInitialBufferSize(int decoderInitialBufferSize)set toinitialBufferSizeHttpDecoderthe initial buffer of the HttpDecoder.HttpClientOptionssetDecompressionSupported(boolean decompressionSupported)Whether the client should send requests with anaccepting-encodingheader set to a compression algorithm.HttpClientOptionssetDefaultHost(String defaultHost)Set the default host name to be used by this client in requests if none is provided when making the request.HttpClientOptionssetDefaultPort(int defaultPort)Set the default port to be used by this client in requests if none is provided when making the request.HttpClientOptionssetEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)Sets the list of enabled SSL/TLS protocols.HttpClientOptionssetForceSni(boolean forceSni)By default, the server name is only sent for Fully Qualified Domain Name (FQDN), setting this property totrueforces the server name to be always sent.HttpClientOptionssetHttp2ClearTextUpgrade(boolean value)Set totruewhen an h2c connection is established using an HTTP/1.1 upgrade request, andfalsewhen an h2c connection is established directly (with prior knowledge).HttpClientOptionssetHttp2ClearTextUpgradeWithPreflightRequest(boolean value)Set totruewhen an h2c connection established using an HTTP/1.1 upgrade request should perform a preflightOPTIONSrequest to the origin server to establish the h2c connection.HttpClientOptionssetHttp2ConnectionWindowSize(int http2ConnectionWindowSize)Set the default HTTP/2 connection window size.HttpClientOptionssetHttp2KeepAliveTimeout(int keepAliveTimeout)Set the keep alive timeout for HTTP/2 connections, in seconds.HttpClientOptionssetHttp2MultiplexingLimit(int limit)Set a client limit of the number concurrent streams for each HTTP/2 connection, this limits the number of streams the client can create for a connection.HttpClientOptionssetHttp2UpgradeMaxContentLength(int http2UpgradeMaxContentLength)Set the HTTP/2 upgrade maximum length of the aggregated content in bytes.HttpClientOptionssetIdleTimeout(int idleTimeout)Set the idle timeout, default time unit is seconds.HttpClientOptionssetIdleTimeoutUnit(TimeUnit idleTimeoutUnit)Set the idle timeout unit.HttpClientOptionssetInitialSettings(Http2Settings settings)Set the HTTP/2 connection settings immediately sent by to the server when the client connects.HttpClientOptionssetKeepAlive(boolean keepAlive)Set whether keep alive is enabled on the clientHttpClientOptionssetKeepAliveTimeout(int keepAliveTimeout)Set the keep alive timeout for HTTP/1.x, in seconds.HttpClientOptionssetKeyCertOptions(KeyCertOptions options)Set the key/cert options.HttpClientOptionssetLocalAddress(String localAddress)Set the local interface to bind for network connections.HttpClientOptionssetLogActivity(boolean logEnabled)Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.HttpClientOptionssetMaxChunkSize(int maxChunkSize)Set the maximum HTTP chunk sizeHttpClientOptionssetMaxHeaderSize(int maxHeaderSize)Set the maximum length of all headers for HTTP/1.x .HttpClientOptionssetMaxInitialLineLength(int maxInitialLineLength)Set the maximum length of the initial line for HTTP/1.x (e.g.HttpClientOptionssetMaxRedirects(int maxRedirects)Set tomaxRedirectsthe maximum number of redirection a request can follow.HttpClientOptionssetMetricsName(String metricsName)Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.HttpClientOptionssetName(String name)Set the client name, used when the client is shared, otherwise ignored.HttpClientOptionssetNonProxyHosts(List<String> nonProxyHosts)Set a list of remote hosts that are not proxied when the client is configured to use a proxy.HttpClientOptionssetPipelining(boolean pipelining)Set whether pipe-lining is enabled on the clientHttpClientOptionssetPipeliningLimit(int limit)Set the limit of pending requests a pipe-lined HTTP/1 connection can send.HttpClientOptionssetProtocolVersion(HttpVersion protocolVersion)Set the protocol version.HttpClientOptionssetProxyOptions(ProxyOptions proxyOptions)Set proxy options for connections via CONNECT proxy (e.g.HttpClientOptionssetReadIdleTimeout(int idleTimeout)Set the read idle timeout, default time unit is seconds.HttpClientOptionssetReceiveBufferSize(int receiveBufferSize)Set the TCP receive buffer sizeHttpClientOptionssetReuseAddress(boolean reuseAddress)Set the value of reuse addressHttpClientOptionssetReusePort(boolean reusePort)Set the value of reuse port.HttpClientOptionssetSendBufferSize(int sendBufferSize)Set the TCP send buffer sizeHttpClientOptionssetShared(boolean shared)Set totrueto share the client.HttpClientOptionssetSoLinger(int soLinger)Set whether SO_linger keep alive is enabledHttpClientOptionssetSsl(boolean ssl)Set whether SSL/TLS is enabledHttpClientOptionssetSslEngineOptions(SSLEngineOptions sslEngineOptions)Set to use SSL engine implementation to use.HttpClientOptionssetSslHandshakeTimeout(long sslHandshakeTimeout)Set the SSL handshake timeout, default time unit is seconds.HttpClientOptionssetSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)Set the SSL handshake timeout unit.HttpClientOptionssetTcpCork(boolean tcpCork)Enable theTCP_CORKoption - only with linux native transport.HttpClientOptionssetTcpFastOpen(boolean tcpFastOpen)Enable theTCP_FASTOPENoption - only with linux native transport.HttpClientOptionssetTcpKeepAlive(boolean tcpKeepAlive)Set whether TCP keep alive is enabledHttpClientOptionssetTcpNoDelay(boolean tcpNoDelay)Set whether TCP no delay is enabledHttpClientOptionssetTcpQuickAck(boolean tcpQuickAck)Enable theTCP_QUICKACKoption - only with linux native transport.HttpClientOptionssetTcpUserTimeout(int tcpUserTimeout)Sets theTCP_USER_TIMEOUToption - only with linux native transport.HttpClientOptionssetTracingPolicy(TracingPolicy tracingPolicy)Set the tracing policy for the client behavior when Vert.x has tracing enabled.HttpClientOptionssetTrafficClass(int trafficClass)Set the value of traffic classHttpClientOptionssetTrustAll(boolean trustAll)Set whether all server certificates should be trustedHttpClientOptionssetTrustOptions(TrustOptions options)Set the trust options.HttpClientOptionssetUseAlpn(boolean useAlpn)Set the ALPN usage.HttpClientOptionssetVerifyHost(boolean verifyHost)Set whether hostname verification is enabledHttpClientOptionssetWriteIdleTimeout(int idleTimeout)Set the write idle timeout, default time unit is seconds.JsonObjecttoJson()Convert to JSON-
Methods inherited from class io.vertx.core.net.ClientOptionsBase
getConnectTimeout, getLocalAddress, getMetricsName, getNonProxyHosts, getOrCreateSSLOptions, getProxyOptions, getSslOptions, isTrustAll
-
Methods inherited from class io.vertx.core.net.TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn
-
Methods inherited from class io.vertx.core.net.NetworkOptions
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
-
-
-
-
Field Detail
-
DEFAULT_HTTP2_MULTIPLEXING_LIMIT
public static final int DEFAULT_HTTP2_MULTIPLEXING_LIMIT
The default maximum number of concurrent streams per connection for HTTP/2 = -1- See Also:
- Constant Field Values
-
DEFAULT_HTTP2_CONNECTION_WINDOW_SIZE
public static final int DEFAULT_HTTP2_CONNECTION_WINDOW_SIZE
The default connection window size for HTTP/2 = -1- See Also:
- Constant Field Values
-
DEFAULT_HTTP2_KEEP_ALIVE_TIMEOUT
public static final int DEFAULT_HTTP2_KEEP_ALIVE_TIMEOUT
The default keep alive timeout for HTTP/2 connection can send = 60 seconds- See Also:
- Constant Field Values
-
DEFAULT_KEEP_ALIVE
public static final boolean DEFAULT_KEEP_ALIVE
Default value of whether keep-alive is enabled =true- See Also:
- Constant Field Values
-
DEFAULT_PIPELINING
public static final boolean DEFAULT_PIPELINING
Default value of whether pipe-lining is enabled =false- See Also:
- Constant Field Values
-
DEFAULT_PIPELINING_LIMIT
public static final int DEFAULT_PIPELINING_LIMIT
The default maximum number of requests an HTTP/1.1 pipe-lined connection can send = 10- See Also:
- Constant Field Values
-
DEFAULT_KEEP_ALIVE_TIMEOUT
public static final int DEFAULT_KEEP_ALIVE_TIMEOUT
The default keep alive timeout for HTTP/1.1 connection can send = 60 seconds- See Also:
- Constant Field Values
-
DEFAULT_DECOMPRESSION_SUPPORTED
public static final boolean DEFAULT_DECOMPRESSION_SUPPORTED
Whether the client should send requests with anaccepting-encodingheader set to a compression algorithm by default =false- See Also:
- Constant Field Values
-
DEFAULT_VERIFY_HOST
public static final boolean DEFAULT_VERIFY_HOST
Default value of whether hostname verification (for SSL/TLS) is enabled =true- See Also:
- Constant Field Values
-
DEFAULT_DEFAULT_HOST
public static final String DEFAULT_DEFAULT_HOST
The default value for host name = "localhost"- See Also:
- Constant Field Values
-
DEFAULT_DEFAULT_PORT
public static final int DEFAULT_DEFAULT_PORT
The default value for port = 80- See Also:
- Constant Field Values
-
DEFAULT_PROTOCOL_VERSION
public static final HttpVersion DEFAULT_PROTOCOL_VERSION
The default protocol version = HTTP/1.1
-
DEFAULT_MAX_CHUNK_SIZE
public static final int DEFAULT_MAX_CHUNK_SIZE
Default max HTTP chunk size = 8192- See Also:
- Constant Field Values
-
DEFAULT_MAX_INITIAL_LINE_LENGTH
public static final int DEFAULT_MAX_INITIAL_LINE_LENGTH
Default max length of the initial line (e.g."HTTP/1.1 200 OK") = 4096- See Also:
- Constant Field Values
-
DEFAULT_MAX_HEADER_SIZE
public static final int DEFAULT_MAX_HEADER_SIZE
Default max length of all headers = 8192- See Also:
- Constant Field Values
-
DEFAULT_ALPN_VERSIONS
public static final List<HttpVersion> DEFAULT_ALPN_VERSIONS
Default Application-Layer Protocol Negotiation versions = [] (automatic according to protocol version)
-
DEFAULT_HTTP2_CLEAR_TEXT_UPGRADE
public static final boolean DEFAULT_HTTP2_CLEAR_TEXT_UPGRADE
Default using HTTP/1.1 upgrade for establishing an h2C connection =true- See Also:
- Constant Field Values
-
DEFAULT_HTTP2_CLEAR_TEXT_UPGRADE_WITH_PREFLIGHT_REQUEST
public static final boolean DEFAULT_HTTP2_CLEAR_TEXT_UPGRADE_WITH_PREFLIGHT_REQUEST
Default to use a preflight OPTIONS request for h2C without prior knowledge connection =false- See Also:
- Constant Field Values
-
DEFAULT_HTTP2_UPGRADE_MAX_CONTENT_LENGTH
public static final int DEFAULT_HTTP2_UPGRADE_MAX_CONTENT_LENGTH
Default maximum length of the aggregated content in bytes- See Also:
- Constant Field Values
-
DEFAULT_MAX_REDIRECTS
public static final int DEFAULT_MAX_REDIRECTS
- See Also:
- Constant Field Values
-
DEFAULT_FORCE_SNI
public static final boolean DEFAULT_FORCE_SNI
- See Also:
- Constant Field Values
-
DEFAULT_DECODER_INITIAL_BUFFER_SIZE
public static final int DEFAULT_DECODER_INITIAL_BUFFER_SIZE
Default initial buffer size for HttpObjectDecoder = 128 bytes- See Also:
- Constant Field Values
-
DEFAULT_TRACING_POLICY
public static final TracingPolicy DEFAULT_TRACING_POLICY
Default tracing control =TracingPolicy.PROPAGATE
-
DEFAULT_SHARED
public static final boolean DEFAULT_SHARED
Default shared client =false- See Also:
- Constant Field Values
-
DEFAULT_NAME
public static final String DEFAULT_NAME
Actual name of anonymous shared client =__vertx.DEFAULT- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpClientOptions
public HttpClientOptions()
Default constructor
-
HttpClientOptions
public HttpClientOptions(ClientOptionsBase other)
Copy constructor- Parameters:
other- the options to copy
-
HttpClientOptions
public HttpClientOptions(HttpClientOptions other)
Copy constructor- Parameters:
other- the options to copy
-
HttpClientOptions
public HttpClientOptions(JsonObject json)
Constructor to create an options from JSON- Parameters:
json- the JSON
-
-
Method Detail
-
toJson
public JsonObject toJson()
Convert to JSON- Overrides:
toJsonin classClientOptionsBase- Returns:
- the JSON
-
setSendBufferSize
public HttpClientOptions setSendBufferSize(int sendBufferSize)
Description copied from class:NetworkOptionsSet the TCP send buffer size- Overrides:
setSendBufferSizein classClientOptionsBase- Parameters:
sendBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReceiveBufferSize
public HttpClientOptions setReceiveBufferSize(int receiveBufferSize)
Description copied from class:NetworkOptionsSet the TCP receive buffer size- Overrides:
setReceiveBufferSizein classClientOptionsBase- Parameters:
receiveBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReuseAddress
public HttpClientOptions setReuseAddress(boolean reuseAddress)
Description copied from class:NetworkOptionsSet the value of reuse address- Overrides:
setReuseAddressin classClientOptionsBase- Parameters:
reuseAddress- the value of reuse address- Returns:
- a reference to this, so the API can be used fluently
-
setReusePort
public HttpClientOptions setReusePort(boolean reusePort)
Description copied from class:NetworkOptionsSet the value of reuse port. This is only supported by native transports.- Overrides:
setReusePortin classClientOptionsBase- Parameters:
reusePort- the value of reuse port- Returns:
- a reference to this, so the API can be used fluently
-
setTrafficClass
public HttpClientOptions setTrafficClass(int trafficClass)
Description copied from class:NetworkOptionsSet the value of traffic class- Overrides:
setTrafficClassin classClientOptionsBase- Parameters:
trafficClass- the value of traffic class- Returns:
- a reference to this, so the API can be used fluently
-
setTcpNoDelay
public HttpClientOptions setTcpNoDelay(boolean tcpNoDelay)
Description copied from class:TCPSSLOptionsSet whether TCP no delay is enabled- Overrides:
setTcpNoDelayin classClientOptionsBase- Parameters:
tcpNoDelay- true if TCP no delay is enabled (Nagle disabled)- Returns:
- a reference to this, so the API can be used fluently
-
setTcpKeepAlive
public HttpClientOptions setTcpKeepAlive(boolean tcpKeepAlive)
Description copied from class:TCPSSLOptionsSet whether TCP keep alive is enabled- Overrides:
setTcpKeepAlivein classClientOptionsBase- Parameters:
tcpKeepAlive- true if TCP keep alive is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setSoLinger
public HttpClientOptions setSoLinger(int soLinger)
Description copied from class:TCPSSLOptionsSet whether SO_linger keep alive is enabled- Overrides:
setSoLingerin classClientOptionsBase- Parameters:
soLinger- true if SO_linger is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeout
public HttpClientOptions setIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptionsSet the idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)- Overrides:
setIdleTimeoutin classClientOptionsBase- Parameters:
idleTimeout- the timeout- Returns:
- a reference to this, so the API can be used fluently
-
setReadIdleTimeout
public HttpClientOptions setReadIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptionsSet the read idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)- Overrides:
setReadIdleTimeoutin classClientOptionsBase- Parameters:
idleTimeout- the read timeout- Returns:
- a reference to this, so the API can be used fluently
-
setWriteIdleTimeout
public HttpClientOptions setWriteIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptionsSet the write idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is sent within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)- Overrides:
setWriteIdleTimeoutin classClientOptionsBase- Parameters:
idleTimeout- the write timeout- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeoutUnit
public HttpClientOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Description copied from class:TCPSSLOptionsSet the idle timeout unit. If not specified, default is seconds.- Overrides:
setIdleTimeoutUnitin classClientOptionsBase- Parameters:
idleTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
public HttpClientOptions setSsl(boolean ssl)
Description copied from class:TCPSSLOptionsSet whether SSL/TLS is enabled- Overrides:
setSslin classClientOptionsBase- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setKeyCertOptions
public HttpClientOptions setKeyCertOptions(KeyCertOptions options)
Description copied from class:TCPSSLOptionsSet the key/cert options.- Overrides:
setKeyCertOptionsin classClientOptionsBase- Parameters:
options- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
setTrustOptions
public HttpClientOptions setTrustOptions(TrustOptions options)
Description copied from class:TCPSSLOptionsSet the trust options.- Overrides:
setTrustOptionsin classClientOptionsBase- Parameters:
options- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
public HttpClientOptions addEnabledCipherSuite(String suite)
Description copied from class:TCPSSLOptionsAdd an enabled cipher suite, appended to the ordered suites.- Overrides:
addEnabledCipherSuitein classClientOptionsBase- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
- See Also:
TCPSSLOptions.getEnabledCipherSuites()
-
removeEnabledCipherSuite
public HttpClientOptions removeEnabledCipherSuite(String suite)
Description copied from class:TCPSSLOptionsRemoves an enabled cipher suite from the ordered suites.- Overrides:
removeEnabledCipherSuitein classClientOptionsBase- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledSecureTransportProtocol
public HttpClientOptions addEnabledSecureTransportProtocol(String protocol)
Description copied from class:TCPSSLOptionsAdd an enabled SSL/TLS protocols, appended to the ordered protocols.- Overrides:
addEnabledSecureTransportProtocolin classClientOptionsBase- Parameters:
protocol- the SSL/TLS protocol to enable- Returns:
- a reference to this, so the API can be used fluently
-
removeEnabledSecureTransportProtocol
public HttpClientOptions removeEnabledSecureTransportProtocol(String protocol)
Description copied from class:TCPSSLOptionsRemoves an enabled SSL/TLS protocol from the ordered protocols.- Overrides:
removeEnabledSecureTransportProtocolin classClientOptionsBase- Parameters:
protocol- the SSL/TLS protocol to disable- Returns:
- a reference to this, so the API can be used fluently
-
setTcpFastOpen
public HttpClientOptions setTcpFastOpen(boolean tcpFastOpen)
Description copied from class:TCPSSLOptionsEnable theTCP_FASTOPENoption - only with linux native transport.- Overrides:
setTcpFastOpenin classClientOptionsBase- Parameters:
tcpFastOpen- the fast open value
-
setTcpCork
public HttpClientOptions setTcpCork(boolean tcpCork)
Description copied from class:TCPSSLOptionsEnable theTCP_CORKoption - only with linux native transport.- Overrides:
setTcpCorkin classClientOptionsBase- Parameters:
tcpCork- the cork value
-
setTcpQuickAck
public HttpClientOptions setTcpQuickAck(boolean tcpQuickAck)
Description copied from class:TCPSSLOptionsEnable theTCP_QUICKACKoption - only with linux native transport.- Overrides:
setTcpQuickAckin classClientOptionsBase- Parameters:
tcpQuickAck- the quick ack value
-
setTcpUserTimeout
public HttpClientOptions setTcpUserTimeout(int tcpUserTimeout)
Description copied from class:TCPSSLOptionsSets theTCP_USER_TIMEOUToption - only with linux native transport.- Overrides:
setTcpUserTimeoutin classClientOptionsBase- Parameters:
tcpUserTimeout- the tcp user timeout value
-
addCrlPath
public HttpClientOptions addCrlPath(String crlPath) throws NullPointerException
Description copied from class:TCPSSLOptionsAdd a CRL path- Overrides:
addCrlPathin classClientOptionsBase- Parameters:
crlPath- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addCrlValue
public HttpClientOptions addCrlValue(Buffer crlValue) throws NullPointerException
Description copied from class:TCPSSLOptionsAdd a CRL value- Overrides:
addCrlValuein classClientOptionsBase- Parameters:
crlValue- the value- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
setConnectTimeout
public HttpClientOptions setConnectTimeout(int connectTimeout)
Description copied from class:ClientOptionsBaseSet the connect timeout- Overrides:
setConnectTimeoutin classClientOptionsBase- Parameters:
connectTimeout- connect timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
setTrustAll
public HttpClientOptions setTrustAll(boolean trustAll)
Description copied from class:ClientOptionsBaseSet whether all server certificates should be trusted- Overrides:
setTrustAllin classClientOptionsBase- Parameters:
trustAll- true if all should be trusted- Returns:
- a reference to this, so the API can be used fluently
-
setEnabledSecureTransportProtocols
public HttpClientOptions setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
Description copied from class:TCPSSLOptionsSets the list of enabled SSL/TLS protocols.- Overrides:
setEnabledSecureTransportProtocolsin classTCPSSLOptions- Parameters:
enabledSecureTransportProtocols- the SSL/TLS protocols to enable- Returns:
- a reference to this, so the API can be used fluently
-
setSslHandshakeTimeout
public HttpClientOptions setSslHandshakeTimeout(long sslHandshakeTimeout)
Description copied from class:TCPSSLOptionsSet the SSL handshake timeout, default time unit is seconds.- Overrides:
setSslHandshakeTimeoutin classTCPSSLOptions- Parameters:
sslHandshakeTimeout- the SSL handshake timeout to set, in milliseconds- Returns:
- a reference to this, so the API can be used fluently
-
setSslHandshakeTimeoutUnit
public HttpClientOptions setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
Description copied from class:TCPSSLOptionsSet the SSL handshake timeout unit. If not specified, default is seconds.- Overrides:
setSslHandshakeTimeoutUnitin classTCPSSLOptions- Parameters:
sslHandshakeTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
getHttp2MultiplexingLimit
public int getHttp2MultiplexingLimit()
- Returns:
- the maximum number of concurrent streams for an HTTP/2 connection,
-1means the value sent by the server
-
setHttp2MultiplexingLimit
public HttpClientOptions setHttp2MultiplexingLimit(int limit)
Set a client limit of the number concurrent streams for each HTTP/2 connection, this limits the number of streams the client can create for a connection. The effective number of streams for a connection is the min of this value and the server's initial settings. Setting the value to-1means to use the value sent by the server's initial settings.-1is the default value.- Parameters:
limit- the maximum concurrent for an HTTP/2 connection- Returns:
- a reference to this, so the API can be used fluently
-
getHttp2ConnectionWindowSize
public int getHttp2ConnectionWindowSize()
- Returns:
- the default HTTP/2 connection window size
-
setHttp2ConnectionWindowSize
public HttpClientOptions setHttp2ConnectionWindowSize(int http2ConnectionWindowSize)
Set the default HTTP/2 connection window size. It overrides the initial window size set byHttp2Settings.getInitialWindowSize(), so the connection window size is greater than for its streams, in order the data throughput. A value of-1reuses the initial window size setting.- Parameters:
http2ConnectionWindowSize- the window size applied to the connection- Returns:
- a reference to this, so the API can be used fluently
-
getHttp2KeepAliveTimeout
public int getHttp2KeepAliveTimeout()
- Returns:
- the keep alive timeout value in seconds for HTTP/2 connections
-
setHttp2KeepAliveTimeout
public HttpClientOptions setHttp2KeepAliveTimeout(int keepAliveTimeout)
Set the keep alive timeout for HTTP/2 connections, in seconds. This value determines how long a connection remains unused in the pool before being evicted and closed. A timeout of0means there is no timeout.- Parameters:
keepAliveTimeout- the timeout, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
getHttp2UpgradeMaxContentLength
public int getHttp2UpgradeMaxContentLength()
- Returns:
- the HTTP/2 upgrade maximum length of the aggregated content in bytes
-
setHttp2UpgradeMaxContentLength
public HttpClientOptions setHttp2UpgradeMaxContentLength(int http2UpgradeMaxContentLength)
Set the HTTP/2 upgrade maximum length of the aggregated content in bytes. This is only taken into account whenhttp2ClearTextUpgradeWithPreflightRequestis set tofalse(which is the default). Whenhttp2ClearTextUpgradeWithPreflightRequestistrue, then the client makes a preflight OPTIONS request and the upgrade will not send a body, voiding the requirements.- Parameters:
http2UpgradeMaxContentLength- the length, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
isKeepAlive
public boolean isKeepAlive()
Is keep alive enabled on the client?- Returns:
trueif enabled
-
setKeepAlive
public HttpClientOptions setKeepAlive(boolean keepAlive)
Set whether keep alive is enabled on the client- Parameters:
keepAlive-trueif enabled- Returns:
- a reference to this, so the API can be used fluently
-
getKeepAliveTimeout
public int getKeepAliveTimeout()
- Returns:
- the keep alive timeout value in seconds for HTTP/1.x connections
-
setKeepAliveTimeout
public HttpClientOptions setKeepAliveTimeout(int keepAliveTimeout)
Set the keep alive timeout for HTTP/1.x, in seconds. This value determines how long a connection remains unused in the pool before being evicted and closed. A timeout of0means there is no timeout.- Parameters:
keepAliveTimeout- the timeout, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
isPipelining
public boolean isPipelining()
Is pipe-lining enabled on the client- Returns:
trueif pipe-lining is enabled
-
setPipelining
public HttpClientOptions setPipelining(boolean pipelining)
Set whether pipe-lining is enabled on the client- Parameters:
pipelining-trueif enabled- Returns:
- a reference to this, so the API can be used fluently
-
getPipeliningLimit
public int getPipeliningLimit()
- Returns:
- the limit of pending requests a pipe-lined HTTP/1 connection can send
-
setPipeliningLimit
public HttpClientOptions setPipeliningLimit(int limit)
Set the limit of pending requests a pipe-lined HTTP/1 connection can send.- Parameters:
limit- the limit of pending requests- Returns:
- a reference to this, so the API can be used fluently
-
isVerifyHost
public boolean isVerifyHost()
Is hostname verification (for SSL/TLS) enabled?- Returns:
trueif enabled
-
setVerifyHost
public HttpClientOptions setVerifyHost(boolean verifyHost)
Set whether hostname verification is enabled- Parameters:
verifyHost-trueif enabled- Returns:
- a reference to this, so the API can be used fluently
-
isDecompressionSupported
public boolean isDecompressionSupported()
- Returns:
trueif the client should send requests with anaccepting-encodingheader set to a compression algorithm,falseotherwise
-
setDecompressionSupported
public HttpClientOptions setDecompressionSupported(boolean decompressionSupported)
Whether the client should send requests with anaccepting-encodingheader set to a compression algorithm.- Parameters:
decompressionSupported-trueif the client should send a request with anaccepting-encodingheader set to a compression algorithm,falseotherwise- Returns:
- a reference to this, so the API can be used fluently
-
getDefaultHost
public String getDefaultHost()
Get the default host name to be used by this client in requests if none is provided when making the request.- Returns:
- the default host name
-
setDefaultHost
public HttpClientOptions setDefaultHost(String defaultHost)
Set the default host name to be used by this client in requests if none is provided when making the request.- Returns:
- a reference to this, so the API can be used fluently
-
getDefaultPort
public int getDefaultPort()
Get the default port to be used by this client in requests if none is provided when making the request.- Returns:
- the default port
-
setDefaultPort
public HttpClientOptions setDefaultPort(int defaultPort)
Set the default port to be used by this client in requests if none is provided when making the request.- Returns:
- a reference to this, so the API can be used fluently
-
getProtocolVersion
public HttpVersion getProtocolVersion()
Get the protocol version.- Returns:
- the protocol version
-
setProtocolVersion
public HttpClientOptions setProtocolVersion(HttpVersion protocolVersion)
Set the protocol version.- Parameters:
protocolVersion- the protocol version- Returns:
- a reference to this, so the API can be used fluently
-
setMaxChunkSize
public HttpClientOptions setMaxChunkSize(int maxChunkSize)
Set the maximum HTTP chunk size- Parameters:
maxChunkSize- the maximum chunk size- Returns:
- a reference to this, so the API can be used fluently
-
getMaxChunkSize
public int getMaxChunkSize()
Returns the maximum HTTP chunk size- Returns:
- the maximum HTTP chunk size
-
getMaxInitialLineLength
public int getMaxInitialLineLength()
- Returns:
- the maximum length of the initial line for HTTP/1.x (e.g.
"GET / HTTP/1.0")
-
setMaxInitialLineLength
public HttpClientOptions setMaxInitialLineLength(int maxInitialLineLength)
Set the maximum length of the initial line for HTTP/1.x (e.g."HTTP/1.1 200 OK")- Parameters:
maxInitialLineLength- the new maximum initial length- Returns:
- a reference to this, so the API can be used fluently
-
getMaxHeaderSize
public int getMaxHeaderSize()
- Returns:
- Returns the maximum length of all headers for HTTP/1.x
-
setMaxHeaderSize
public HttpClientOptions setMaxHeaderSize(int maxHeaderSize)
Set the maximum length of all headers for HTTP/1.x .- Parameters:
maxHeaderSize- the new maximum length- Returns:
- a reference to this, so the API can be used fluently
-
getInitialSettings
public Http2Settings getInitialSettings()
- Returns:
- the initial HTTP/2 connection settings
-
setInitialSettings
public HttpClientOptions setInitialSettings(Http2Settings settings)
Set the HTTP/2 connection settings immediately sent by to the server when the client connects.- Parameters:
settings- the settings value- Returns:
- a reference to this, so the API can be used fluently
-
setUseAlpn
public HttpClientOptions setUseAlpn(boolean useAlpn)
Description copied from class:TCPSSLOptionsSet the ALPN usage.- Overrides:
setUseAlpnin classClientOptionsBase- Parameters:
useAlpn- true when Application-Layer Protocol Negotiation should be used
-
setSslEngineOptions
public HttpClientOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Description copied from class:TCPSSLOptionsSet to use SSL engine implementation to use.- Overrides:
setSslEngineOptionsin classClientOptionsBase- Parameters:
sslEngineOptions- the ssl engine to use- Returns:
- a reference to this, so the API can be used fluently
-
getAlpnVersions
public List<HttpVersion> getAlpnVersions()
- Returns:
- the list of protocol versions to provide during the Application-Layer Protocol Negotiation. When
the list is empty, the client provides a best effort list according to
setProtocolVersion(io.vertx.core.http.HttpVersion)
-
setAlpnVersions
public HttpClientOptions setAlpnVersions(List<HttpVersion> alpnVersions)
Set the list of protocol versions to provide to the server during the Application-Layer Protocol Negotiation. When the list is empty, the client provides a best effort list according tosetProtocolVersion(io.vertx.core.http.HttpVersion):HttpVersion.HTTP_2: [ "h2", "http/1.1" ]- otherwise: [
getProtocolVersion()]
- Parameters:
alpnVersions- the versions- Returns:
- a reference to this, so the API can be used fluently
-
isHttp2ClearTextUpgrade
public boolean isHttp2ClearTextUpgrade()
- Returns:
truewhen an h2c connection is established using an HTTP/1.1 upgrade request,falsewhen directly
-
setHttp2ClearTextUpgrade
public HttpClientOptions setHttp2ClearTextUpgrade(boolean value)
Set totruewhen an h2c connection is established using an HTTP/1.1 upgrade request, andfalsewhen an h2c connection is established directly (with prior knowledge).- Parameters:
value- the upgrade value- Returns:
- a reference to this, so the API can be used fluently
-
isHttp2ClearTextUpgradeWithPreflightRequest
public boolean isHttp2ClearTextUpgradeWithPreflightRequest()
- Returns:
truewhen an h2c connection established using an HTTP/1.1 upgrade request should perform a preflightOPTIONSrequest to the origin server to establish the h2c connection
-
setHttp2ClearTextUpgradeWithPreflightRequest
public HttpClientOptions setHttp2ClearTextUpgradeWithPreflightRequest(boolean value)
Set totruewhen an h2c connection established using an HTTP/1.1 upgrade request should perform a preflightOPTIONSrequest to the origin server to establish the h2c connection.- Parameters:
value- the upgrade value- Returns:
- a reference to this, so the API can be used fluently
-
getMaxRedirects
public int getMaxRedirects()
- Returns:
- the maximum number of redirection a request can follow
-
setMaxRedirects
public HttpClientOptions setMaxRedirects(int maxRedirects)
Set tomaxRedirectsthe maximum number of redirection a request can follow.- Parameters:
maxRedirects- the maximum number of redirection- Returns:
- a reference to this, so the API can be used fluently
-
isForceSni
public boolean isForceSni()
- Returns:
- whether the client should always use SNI on TLS/SSL connections
-
setForceSni
public HttpClientOptions setForceSni(boolean forceSni)
By default, the server name is only sent for Fully Qualified Domain Name (FQDN), setting this property totrueforces the server name to be always sent.- Parameters:
forceSni-truewhen the client should always use SNI on TLS/SSL connections- Returns:
- a reference to this, so the API can be used fluently
-
setMetricsName
public HttpClientOptions setMetricsName(String metricsName)
Description copied from class:ClientOptionsBaseSet the metrics name identifying the reported metrics, useful for grouping metrics with the same name.- Overrides:
setMetricsNamein classClientOptionsBase- Parameters:
metricsName- the metrics name- Returns:
- a reference to this, so the API can be used fluently
-
setProxyOptions
public HttpClientOptions setProxyOptions(ProxyOptions proxyOptions)
Description copied from class:ClientOptionsBaseSet proxy options for connections via CONNECT proxy (e.g. Squid) or a SOCKS proxy.- Overrides:
setProxyOptionsin classClientOptionsBase- Parameters:
proxyOptions- proxy options object- Returns:
- a reference to this, so the API can be used fluently
-
setNonProxyHosts
public HttpClientOptions setNonProxyHosts(List<String> nonProxyHosts)
Description copied from class:ClientOptionsBaseSet a list of remote hosts that are not proxied when the client is configured to use a proxy. This list serves the same purpose than the JVMnonProxyHostsconfiguration.Entries can use the * wildcard character for pattern matching, e.g *.example.com matches www.example.com.
- Overrides:
setNonProxyHostsin classClientOptionsBase- Parameters:
nonProxyHosts- the list of non proxies hosts- Returns:
- a reference to this, so the API can be used fluently
-
addNonProxyHost
public HttpClientOptions addNonProxyHost(String nonProxyHost)
Description copied from class:ClientOptionsBaseAdd ahostto theClientOptionsBase.getNonProxyHosts()list.- Overrides:
addNonProxyHostin classClientOptionsBase- Parameters:
nonProxyHost- the added host- Returns:
- a reference to this, so the API can be used fluently
-
setLocalAddress
public HttpClientOptions setLocalAddress(String localAddress)
Description copied from class:ClientOptionsBaseSet the local interface to bind for network connections. When the local address is null, it will pick any local address, the default local address is null.- Overrides:
setLocalAddressin classClientOptionsBase- Parameters:
localAddress- the local address- Returns:
- a reference to this, so the API can be used fluently
-
setLogActivity
public HttpClientOptions setLogActivity(boolean logEnabled)
Description copied from class:NetworkOptionsSet to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setLogActivityin classClientOptionsBase- Parameters:
logEnabled- true for logging the network activity- Returns:
- a reference to this, so the API can be used fluently
-
setActivityLogDataFormat
public HttpClientOptions setActivityLogDataFormat(ByteBufFormat activityLogDataFormat)
Description copied from class:NetworkOptionsSet the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setActivityLogDataFormatin classClientOptionsBase- Parameters:
activityLogDataFormat- the format to use- Returns:
- a reference to this, so the API can be used fluently
-
getDecoderInitialBufferSize
public int getDecoderInitialBufferSize()
- Returns:
- the initial buffer size for the HTTP decoder
-
setDecoderInitialBufferSize
public HttpClientOptions setDecoderInitialBufferSize(int decoderInitialBufferSize)
set toinitialBufferSizeHttpDecoderthe initial buffer of the HttpDecoder.- Parameters:
decoderInitialBufferSize- the initial buffer size- Returns:
- a reference to this, so the API can be used fluently
-
getTracingPolicy
public TracingPolicy getTracingPolicy()
- Returns:
- the tracing policy
-
setTracingPolicy
public HttpClientOptions setTracingPolicy(TracingPolicy tracingPolicy)
Set the tracing policy for the client behavior when Vert.x has tracing enabled.- Parameters:
tracingPolicy- the tracing policy- Returns:
- a reference to this, so the API can be used fluently
-
isShared
public boolean isShared()
- Returns:
- whether the pool is shared
-
setShared
public HttpClientOptions setShared(boolean shared)
Set totrueto share the client.There can be multiple shared clients distinguished by
getName(), when no specific name is set, theDEFAULT_NAMEis used.- Parameters:
shared-trueto use a shared client- Returns:
- a reference to this, so the API can be used fluently
-
getName
public String getName()
- Returns:
- the client name used for sharing
-
setName
public HttpClientOptions setName(String name)
Set the client name, used when the client is shared, otherwise ignored.- Parameters:
name- the new name- Returns:
- a reference to this, so the API can be used fluently
-
-