Interface HttpClientConfiguration
HTTP client module configuration.
- Since:
- 1.6
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumDesignates a proxy protocol. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<HttpVersion> Default HTTP versions accepted by the client.static final StringDefault user agent. -
Method Summary
Modifier and TypeMethodDescriptionThe number of event loops to allocate to the client.default intBrotly compression mode (0=GENERIC, 1=TEXT, 2=FONT).default intBrotly compression quality.default intBrotly compression window.default intThe threshold beyond which the response body should be compressed.default intDeflate compression level.default intDeflate compression memory level.default intDeflate compression window bits.default booleanEnables/Disables HTTP compression.default intGzip compression level.default intGzip compression memory level.default intGzip compression window bits.default intZstandard compression block size (in bytes).default intZstandard compression level.default intZstandard compression max encode size (in bytes).default booleanEnables/Disables HTTP decompression.default longThe graceful shutdown timeout in milliseconds after which a connection is closed even if there are still active exchanges.default Set<HttpVersion> The set of HTTP protocols accepted by the client.default LongThe HTTP/1.1 pipelining limit which corresponds to the maximum concurrent requests on a single connection.default intHTTP/1.x initial buffer size in bytes used when parsing the lines of the HTTP headers.default intHTTP/1.x max chunk size in bytes.default intHTTP/1.x max header line size in bytes.default intHTTP/1.x max length in bytes of the first line of the HTTP headers.default booleanEnables/Disables HTTP/1.x header validation.default LongThe HTTP/2 header table size.default IntegerHTTP/2 initial window size.default LongHTTP/2 max concurrent streams.default IntegerHTTP/2 max frame size.default IntegerHTTP/2 max header list size.default booleanEnables/Disables HTTP/2.0 header validation as defined by RFC 7540 Section 8.1.2.6.The pool's request buffer size.default longThe pool's clean period in milliseconds.default longThe pool connection timeout in milliseconds.default LongThe pool's connection keep alive timeout in milliseconds.default intThe maximum size of the client connection pool.default intThe number of random connections to consider when selecting a connection in the pool.default floatThe connection load threshold between 0 and 1 above which a new connection must be added to the pool.The poxy server host.The password to use to authenticate to the proxy server.The proxy server port.The proxy protocol.The username to use to authenticate to the proxy server.default longThe request timeout in milliseconds.default booleanSendsuser-agentheader.String[]The list of ciphers to exclude.String[]The list of ciphers to include.default booleanEnables/Disables HTTPS.The alias of the key in the key store.The password for the alias of the key in the key store.The path to the key store.The password of the key store.default StringThe type of key store.default booleanSends Server Name Indication parameter during TLS handshake.default booleanIndicates whether all server certificates should be trusted (including self-signed certificates).The trust manager factory.The path to the key store.The password of the key store.default StringThe type of key store.default StringThe value of theuser-agentheader to send.default booleanIndicates whether a WebSocket should be closed when the outbound frames publisher completes.default booleanEnables/Disables WebSocket per frame compression.default intWebSocket per frame compression level.default longThe time in milliseconds to wait after a close frame has been sent for a close frame to be received before closing the WebSocket unilaterally.default IntegerWebSocket max frame size in bytes.default booleanAllows WebSocket server to activate client_no_context_takeover.default booleanAllows WebSocket server to customize the client inflater window size.default booleanEnables/Disables WebSocket per message compression.default intWebSocket per message compression level.default booleanIndicates whether client needs to activate server_no_context_takeover if server is compatible with.default intIndicates the requested sever window size to use if server inflater is customizable.
-
Field Details
-
DEFAULT_HTTP_PROTOCOL_VERSIONS
Default HTTP versions accepted by the client. -
USER_AGENT
Default user agent.
-
-
Method Details
-
client_event_loop_group_size
Integer client_event_loop_group_size()The number of event loops to allocate to the client.
If not specified, the number of thread allocated to the root event loop group shall be used.
- Returns:
- the number of threads to allocate
-
pool_max_size
default int pool_max_size()The maximum size of the client connection pool.
Defaults to
2.- Returns:
- the maximum size of the pool
-
pool_clean_period
default long pool_clean_period()The pool's clean period in milliseconds.
This specifies the frequency at which unnecessary connections are removed from the active pool and parked until either a request burst requires the connection to be reinstated or until the keep alive timeout is reached in which case the connection is closed and definitely removed from the pool.
Defaults to
1000(1 seconds).- Returns:
- the pool's clean period
-
pool_buffer_size
Integer pool_buffer_size()The pool's request buffer size.
This represents the limit beyond which requests can't be buffered and are rejectded (
nullmeans no limit).- Returns:
- the pool's request buffer size
-
pool_keep_alive_timeout
The pool's connection keep alive timeout in milliseconds.
The represents the time beyond which an inactive connection is closed and removed from the pool (
nullmeans no timeout).Defaults to
60000.- Returns:
- the pool
-
pool_connect_timeout
default long pool_connect_timeout()The pool connection timeout in milliseconds.
Note that this timeout specifies the maximum time to wait for the connection pool to return a connection, this differs from
NetClientConfiguration.connect_timeout()which specifies the connection timeout at the socket level.Defaults to
60000.- Returns:
- the pool connection timeout
-
pool_select_choice_count
default int pool_select_choice_count()The number of random connections to consider when selecting a connection in the pool.
The pool will retain the connection with the lowest load factor and compare it to
pool_select_connection_load_threshold()to determine whether the creation of a new connection is required.Defaults to
2.- Returns:
- the number of random connections to consider when selecting a connection
-
pool_select_connection_load_threshold
default float pool_select_connection_load_threshold()The connection load threshold between 0 and 1 above which a new connection must be added to the pool.
Each connection in the pool maintain an internal load factor which is the ratio between the active requests and the connection capacity. When selecting a connection the pool tries to select the connection with the minimum load factor, this parameter allows to force the pool to create new connection when that load factor is above a specific threshold. Setting this to
1means it should reduce the number of connection, setting it to0means it should optimize throughput (i.e. create and use the maximum allowed number of connections).Defaults to
0.5- Returns:
- the pool connection load threshold
-
request_timeout
default long request_timeout()The request timeout in milliseconds.
A request times out after it has been sent and no response has been received within that period.
Set to
0to disable, defaults to60000.- Returns:
- the request timeout
-
graceful_shutdown_timeout
default long graceful_shutdown_timeout()The graceful shutdown timeout in milliseconds after which a connection is closed even if there are still active exchanges.
Defaults to
30000.- Returns:
- the graceful shutdown timeout
-
http_protocol_versions
The set of HTTP protocols accepted by the client.
Defaults to
HttpVersion.HTTP_2_0, HttpVersion.HTTP_1_1- Returns:
- a set of HTTP versions
-
send_user_agent
default boolean send_user_agent()Sends
user-agentheader.Defaults to
true- Returns:
- true to send the user agent, false otherwise.
-
user_agent
The value of the
user-agentheader to send.Defaults to
Inverno/x.y- Returns:
- the user agent
-
compression_enabled
default boolean compression_enabled()Enables/Disables HTTP compression.
Defaults to
false.- Returns:
- true if compression is enabled, false otherwise
-
decompression_enabled
default boolean decompression_enabled()Enables/Disables HTTP decompression.
Defaults to
false.- Returns:
- true if decompression is enabled, false otherwise
-
compression_contentSizeThreshold
default int compression_contentSizeThreshold()The threshold beyond which the response body should be compressed.
Defaults to
0which means all responses are compressed.- Returns:
- the compression content size threshold
-
compression_brotli_quality
default int compression_brotli_quality()Brotly compression quality.
Defaults to
4.- Returns:
- the brotli compression quality
-
compression_brotli_window
default int compression_brotli_window()Brotly compression window.
Defaults to
-1.- Returns:
- the brotli compression window
-
compression_brotli_mode
default int compression_brotli_mode()Brotly compression mode (0=GENERIC, 1=TEXT, 2=FONT).
Defaults to
1(TEXT).- Returns:
- the brotli compression mode
-
compression_deflate_compressionLevel
default int compression_deflate_compressionLevel()Deflate compression level.
Defaults to
6.- Returns:
- the deflate compression level
-
compression_deflate_windowBits
default int compression_deflate_windowBits()Deflate compression window bits.
Defaults to
15.- Returns:
- the deflate compression window bits
-
compression_deflate_memLevel
default int compression_deflate_memLevel()Deflate compression memory level.
Defaults to
8.- Returns:
- the deflate compression memory level bits
-
compression_gzip_compressionLevel
default int compression_gzip_compressionLevel()Gzip compression level.
Defaults to
6.- Returns:
- the gzip compression level
-
compression_gzip_windowBits
default int compression_gzip_windowBits()Gzip compression window bits.
Defaults to
15.- Returns:
- the gzip compression window bits
-
compression_gzip_memLevel
default int compression_gzip_memLevel()Gzip compression memory level.
Defaults to
8.- Returns:
- the gzip compression memory level
-
compression_zstd_blockSize
default int compression_zstd_blockSize()Zstandard compression block size (in bytes).
Defaults to 64KB.
- Returns:
- the zstd compression block size
-
compression_zstd_compressionLevel
default int compression_zstd_compressionLevel()Zstandard compression level.
Defaults to
3.- Returns:
- the zstd compression level
-
compression_zstd_maxEncodeSize
default int compression_zstd_maxEncodeSize()Zstandard compression max encode size (in bytes).
Defaults to 32MB.
- Returns:
- the zstd compression max encode size
-
tls_enabled
default boolean tls_enabled()Enables/Disables HTTPS.
Defaults to
false.- Returns:
- true if the option is enabled, false otherwise
-
tls_key_store
URI tls_key_store()The path to the key store.
Note that this overrides both
tls_trust_manager_factory()andtls_trust_all().- Returns:
- the key store URI
-
tls_key_store_type
The type of key store.
Defaults to
JKS.- Returns:
- the key store type
-
tls_key_store_password
String tls_key_store_password()The password of the key store.
- Returns:
- a password
-
tls_key_alias
String tls_key_alias()The alias of the key in the key store.
- Returns:
- a key alias
-
tls_key_alias_password
String tls_key_alias_password()The password for the alias of the key in the key store.
- Returns:
- a password
-
tls_trust_store
URI tls_trust_store()The path to the key store.
- Returns:
- the key store URI
-
tls_trust_store_type
The type of key store.
Defaults to
JKS.- Returns:
- the key store type
-
tls_trust_store_password
String tls_trust_store_password()The password of the key store.
- Returns:
- a password
-
tls_trust_manager_factory
TrustManagerFactory tls_trust_manager_factory()The trust manager factory.
Note that this overrides
tls_trust_all().- Returns:
- the trust manager factory
-
tls_trust_all
default boolean tls_trust_all()Indicates whether all server certificates should be trusted (including self-signed certificates).
Note that this overrides
tls_trust_manager_factory().Defaults to
false- Returns:
- true to trust all server certificates
-
tls_send_sni
default boolean tls_send_sni()Sends Server Name Indication parameter during TLS handshake.
Defaults to
false.- Returns:
- true if the client must send the hostname to the server during TLS handshake
-
tls_ciphers_includes
String[] tls_ciphers_includes()The list of ciphers to include.
- Returns:
- an array of ciphers
-
tls_ciphers_excludes
String[] tls_ciphers_excludes()The list of ciphers to exclude.
- Returns:
- an array of ciphers
-
http1x_initial_buffer_size
default int http1x_initial_buffer_size()HTTP/1.x initial buffer size in bytes used when parsing the lines of the HTTP headers.
Defaults to
128.- Returns:
- the initial buffer size
-
http1x_max_initial_line_length
default int http1x_max_initial_line_length()HTTP/1.x max length in bytes of the first line of the HTTP headers.
Defaults to
4096.- Returns:
- the max initial line length
-
http1x_max_chunk_size
default int http1x_max_chunk_size()HTTP/1.x max chunk size in bytes.
Defaults to
8192.- Returns:
- the max chunk size
-
http1x_max_header_size
default int http1x_max_header_size()HTTP/1.x max header line size in bytes.
Defaults to
8192.- Returns:
- the max header line size
-
http1x_validate_headers
default boolean http1x_validate_headers()Enables/Disables HTTP/1.x header validation.
It is recommended to always validate headers in order to prevent request/response splitting attack.
Defaults to
true.- Returns:
- true to validate headers, false otherwise
-
http1_max_concurrent_requests
The HTTP/1.1 pipelining limit which corresponds to the maximum concurrent requests on a single connection.
Defaults to
10(nullmeans no limit).- Returns:
- the maximum HTTP/1.1 concurrent requests on a single connection
-
http2_header_table_size
The HTTP/2 header table size.
Defaults to
4096.- Returns:
- the header table size
-
http2_max_concurrent_streams
HTTP/2 max concurrent streams.
Defaults to
100.- Returns:
- max concurrent streams
-
http2_initial_window_size
HTTP/2 initial window size.
Defaults to
65535.- Returns:
- initial window size
-
http2_max_frame_size
HTTP/2 max frame size.
Defaults to
16384.- Returns:
- max frame size
-
http2_max_header_list_size
HTTP/2 max header list size.
Defaults to
Integer.MAX_VALUE.- Returns:
- max header list size
-
http2_validate_headers
default boolean http2_validate_headers()Enables/Disables HTTP/2.0 header validation as defined by RFC 7540 Section 8.1.2.6.
Defaults to
true.- Returns:
- true to validate headers, false otherwise
-
ws_max_frame_size
WebSocket max frame size in bytes.
Defaults to
65536.- Returns:
- the WebSocket max frame size
-
ws_frame_compression_enabled
default boolean ws_frame_compression_enabled()Enables/Disables WebSocket per frame compression.
Defaults to
false.- Returns:
- true if WebSocket per frame is enabled, false otherwise
-
ws_frame_compression_level
default int ws_frame_compression_level()WebSocket per frame compression level.
Defaults to
6.- Returns:
- the WebSocket frame compression level
-
ws_message_compression_enabled
default boolean ws_message_compression_enabled()Enables/Disables WebSocket per message compression.
Defaults to
false.- Returns:
- true if WebSocket per message is enabled, false otherwise
-
ws_message_compression_level
default int ws_message_compression_level()WebSocket per message compression level.
Defaults to
6.- Returns:
- the WebSocket message compression level
-
ws_message_allow_client_window_size
default boolean ws_message_allow_client_window_size()Allows WebSocket server to customize the client inflater window size.
Defaults to
false.- Returns:
- true to allow WebSocket server to customize the client inflater window size, false otherwise
-
ws_message_requested_server_window_size
default int ws_message_requested_server_window_size()Indicates the requested sever window size to use if server inflater is customizable.
Defaults to
15.- Returns:
- the requested sever window size to use if server inflater is customizable
-
ws_message_allow_client_no_context
default boolean ws_message_allow_client_no_context()Allows WebSocket server to activate client_no_context_takeover.
Defaults to
false.- Returns:
- true to allow WebSocket server to activate client_no_context_takeover, false otherwise
-
ws_message_requested_server_no_context
default boolean ws_message_requested_server_no_context()Indicates whether client needs to activate server_no_context_takeover if server is compatible with.
Defaults to
false- Returns:
- true to activate server_no_context_takeover if server is compatible with, false otherwise
-
ws_close_on_outbound_complete
default boolean ws_close_on_outbound_complete()Indicates whether a WebSocket should be closed when the outbound frames publisher completes.
Note that this behaviour can be overridden by invoking
BaseWebSocketExchange.Outbound.closeOnComplete(boolean)on the WebSocket exchange's outbound.Defaults to
false- Returns:
- true to close the WebSocket when the outbound frames publisher completes, false otherwise.
-
ws_inbound_close_frame_timeout
default long ws_inbound_close_frame_timeout()The time in milliseconds to wait after a close frame has been sent for a close frame to be received before closing the WebSocket unilaterally.
Defaults to
60000.- Returns:
- the inbound close frame timeout
-
proxy_host
String proxy_host()The poxy server host.
Default to
null.- Returns:
- the proxy host or null if no proxy shall be used
-
proxy_port
Integer proxy_port()The proxy server port.
Defaults to
null.- Returns:
- the proxy port or null if no proxy shall be used
-
proxy_username
String proxy_username()The username to use to authenticate to the proxy server.
Defaults to
null.- Returns:
- the proxy username or null
-
proxy_password
String proxy_password()The password to use to authenticate to the proxy server.
Defaults to
null.- Returns:
- the proxy password or null
-
proxy_protocol
The proxy protocol.
Defaults to
HttpClientConfiguration.ProxyProtocol.HTTP.- Returns:
- the proxy protocol
-