public final class HttpClientOptions extends ClientOptions
ClientOptions.ProxyDEFAULT_PORT| Modifier and Type | Method and Description |
|---|---|
HttpClientOptions |
afterChannelInit(java.util.function.Consumer<? super Channel> afterChannelInit)
Setup the callback after each
Channel initialization and after
reactor-netty
pipeline handlers have been registered. |
<T> HttpClientOptions |
attr(AttributeKey<T> key,
T value)
Attribute default attribute to the future
Channel connection. |
HttpClientOptions |
channelGroup(ChannelGroup channelGroup)
Provide a
ChannelGroup for each active remote channel will be held in the
provided group. |
HttpClientOptions |
compression(boolean enabled)
Enable GZip accept-encoding header and support for compressed response
|
HttpClientOptions |
connect(InetSocketAddress connectAddress)
The address to which this client should connect.
|
HttpClientOptions |
connect(String host,
int port)
The host and port to which this client should connect.
|
HttpClientOptions |
connect(java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
The address to which this client should connect.
|
static HttpClientOptions |
create()
Create new
HttpClientOptions. |
protected SslContext |
defaultSslContext()
Default Ssl context if none configured or null;
|
HttpClientOptions |
disablePool()
Disable current
ClientOptions.poolResources |
HttpClientOptions |
duplicate()
Return a copy of all options and references such as
NettyOptions.onChannelInit(Predicate). |
HttpClientOptions |
eventLoopGroup(EventLoopGroup eventLoopGroup)
Provide a shared
EventLoopGroup each Connector handler. |
InetSocketAddress |
getRemoteAddress(URI uri)
Return a new
InetSocketAddress from the URI. |
HttpClientOptions |
loopResources(LoopResources eventLoopSelector)
Provide an
EventLoopGroup supplier. |
HttpClientOptions |
onChannelInit(java.util.function.Predicate<? super Channel> onChannelInit)
A callback for each
Channel initialization and before reactor-netty
pipeline handlers have been registered. |
<T> HttpClientOptions |
option(ChannelOption<T> key,
T value)
Set a
ChannelOption value for low level connection settings like
SO_TIMEOUT or SO_KEEPALIVE. |
HttpClientOptions |
poolResources(PoolResources poolResources)
Configures the
ChannelPool selector for the socket. |
HttpClientOptions |
preferNative(boolean preferNative)
Set the preferred native option.
|
HttpClientOptions |
protocolFamily(InternetProtocolFamily protocolFamily)
Configures the version family for the socket.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
InetSocketAddress connectAddress)
Let this client connect through a proxy by providing an address.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
InetSocketAddress connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing an address and credentials.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
String host,
int port)
Let this client connect through a proxy by providing a host and port.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
String host,
int port,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing a host, port and credentials.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
Let this client connect through a proxy by providing a proxy type and address.
|
HttpClientOptions |
proxy(ClientOptions.Proxy type,
java.util.function.Supplier<? extends InetSocketAddress> connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing an address supplier.
|
HttpClientOptions |
proxy(InetSocketAddress connectAddress)
Let this client connect through an HTTP proxy by providing an address.
|
HttpClientOptions |
proxy(InetSocketAddress connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through an HTTP proxy by providing an address and
credentials.
|
HttpClientOptions |
proxy(String host,
int port)
Let this client connect through an HTTP proxy by providing a host and port.
|
HttpClientOptions |
proxy(String host,
int port,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through an HTTP proxy by providing a host, port and
credentials.
|
HttpClientOptions |
proxy(java.util.function.Supplier<? extends InetSocketAddress> connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through an HTTP proxy by providing an address supplier
and credentials.
|
HttpClientOptions |
resolver(AddressResolverGroup<?> resolver)
Assign an
AddressResolverGroup. |
HttpClientOptions |
sslCloseNotifyFlushTimeout(java.time.Duration sslCloseNotifyFlushTimeout)
Set the options to use for configuring SSL close_notify flush timeout.
|
HttpClientOptions |
sslCloseNotifyFlushTimeoutMillis(long sslCloseNotifyFlushTimeoutMillis)
Set the options to use for configuring SSL close_notify flush timeout.
|
HttpClientOptions |
sslCloseNotifyReadTimeout(java.time.Duration sslCloseNotifyReadTimeout)
Set the options to use for configuring SSL close_notify read timeout.
|
HttpClientOptions |
sslCloseNotifyReadTimeoutMillis(long sslCloseNotifyReadTimeoutMillis)
Set the options to use for configuring SSL close_notify read timeout.
|
HttpClientOptions |
sslContext(SslContext sslContext)
Set the options to use for configuring SSL.
|
HttpClientOptions |
sslHandshakeTimeout(java.time.Duration sslHandshakeTimeout)
Set the options to use for configuring SSL handshake timeout.
|
HttpClientOptions |
sslHandshakeTimeoutMillis(long sslHandshakeTimeoutMillis)
Set the options to use for configuring SSL handshake timeout.
|
HttpClientOptions |
sslSupport()
Enable default sslContext support
|
HttpClientOptions |
sslSupport(java.util.function.Consumer<? super SslContextBuilder> configurator)
Enable default sslContext support and enable further customization via the passed
configurator.
|
connect, get, getAddress, getPoolResources, getProxyHandler, useDatagramChannel, useProxyafterChannelInit, getLoopResources, getSslHandler, onChannelInit, preferNative, toStringpublic static HttpClientOptions create()
HttpClientOptions.public HttpClientOptions afterChannelInit(java.util.function.Consumer<? super Channel> afterChannelInit)
NettyOptionsChannel initialization and after
reactor-netty
pipeline handlers have been registered.afterChannelInit in class NettyOptions<Bootstrap,ClientOptions>afterChannelInit - the post channel setup handlerthisNettyOptions.onChannelInit(Predicate)public <T> HttpClientOptions attr(AttributeKey<T> key, T value)
NettyOptionsChannel connection. They will
be available via NettyInbound.attr(AttributeKey).attr in class NettyOptions<Bootstrap,ClientOptions>T - the attribute typekey - the attribute keyvalue - the attribute valueAbstractBootstrap.attr(AttributeKey, Object)public HttpClientOptions channelGroup(ChannelGroup channelGroup)
NettyOptionsChannelGroup for each active remote channel will be held in the
provided group.channelGroup in class NettyOptions<Bootstrap,ClientOptions>channelGroup - a ChannelGroup to monitor remote channelpublic HttpClientOptions loopResources(LoopResources eventLoopSelector)
NettyOptionsEventLoopGroup supplier.
Note that server might call it twice for both their selection and io loops.loopResources in class NettyOptions<Bootstrap,ClientOptions>eventLoopSelector - a selector accepting native runtime expectation and
returning an eventLoopGrouppublic HttpClientOptions connect(@Nonnull String host, int port)
ClientOptionsconnect in class ClientOptionshost - The host to connect to.port - The port to connect to.public HttpClientOptions connect(@Nonnull InetSocketAddress connectAddress)
ClientOptionsconnect in class ClientOptionsconnectAddress - The address to connect to.public HttpClientOptions connect(@Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
ClientOptionsconnect in class ClientOptionsconnectAddress - A supplier of the address to connect to.public HttpClientOptions disablePool()
ClientOptionsClientOptions.poolResourcesdisablePool in class ClientOptionsthispublic HttpClientOptions duplicate()
NettyOptionsNettyOptions.onChannelInit(Predicate). Further option uses on the returned builder will
be fully isolated from this option builder.duplicate in class ClientOptionspublic HttpClientOptions eventLoopGroup(EventLoopGroup eventLoopGroup)
NettyOptionsEventLoopGroup each Connector handler.eventLoopGroup in class NettyOptions<Bootstrap,ClientOptions>eventLoopGroup - an eventLoopGroup to shareEventLoopGroup provider given the native runtime expectationpublic HttpClientOptions compression(boolean enabled)
enabled - true whether gzip support is enabledpublic final InetSocketAddress getRemoteAddress(URI uri)
InetSocketAddress from the URI.
If the port is undefined (-1), a default port is used (80 or 443 depending on
whether the URI is secure or not). If a proxy is used, the
returned address is provided unresolved.
uri - URI to extract host and port information fromInetSocketAddresspublic HttpClientOptions onChannelInit(java.util.function.Predicate<? super Channel> onChannelInit)
NettyOptionsChannel initialization and before reactor-netty
pipeline handlers have been registered.onChannelInit in class NettyOptions<Bootstrap,ClientOptions>onChannelInit - pre channel pipeline setup handlerthisNettyOptions.afterChannelInit(Consumer)public <T> HttpClientOptions option(ChannelOption<T> key, T value)
NettyOptionsChannelOption value for low level connection settings like
SO_TIMEOUT or SO_KEEPALIVE. This will apply to each new channel from remote
peer.option in class NettyOptions<Bootstrap,ClientOptions>T - the option typekey - the option keythisAbstractBootstrap.option(ChannelOption, Object)public HttpClientOptions preferNative(boolean preferNative)
NettyOptionspreferNative in class NettyOptions<Bootstrap,ClientOptions>preferNative - Should the connector prefer native (epoll) if availablethispublic HttpClientOptions poolResources(PoolResources poolResources)
ClientOptionsChannelPool selector for the socket. Will effectively
enable client connection-pooling.poolResources in class ClientOptionspoolResources - the PoolResources given
an InetSocketAddressthispublic HttpClientOptions protocolFamily(InternetProtocolFamily protocolFamily)
ClientOptionsprotocolFamily in class ClientOptionsprotocolFamily - the version family for the socket, or null for the system
default familythispublic HttpClientOptions proxy(@Nonnull String host, int port)
host - The proxy host to connect to.port - The proxy port to connect to.public HttpClientOptions proxy(@Nonnull String host, int port, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
host - The proxy host to connect to.port - The proxy port to connect to.username - The proxy username to use.password - A password-providing function for the proxy.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull String host, int port, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
ClientOptionsproxy in class ClientOptionstype - The proxy type.host - The proxy host to connect to.port - The proxy port to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull String host, int port)
ClientOptionsproxy in class ClientOptionstype - The proxy type.host - The host to connect to.port - The port to connect to.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull InetSocketAddress connectAddress)
ClientOptionsproxy in class ClientOptionstype - The proxy type.connectAddress - The address to connect to.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull InetSocketAddress connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
ClientOptionsproxy in class ClientOptionstype - The proxy type.connectAddress - The address to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
ClientOptionsproxy in class ClientOptionstype - The proxy type.connectAddress - The supplier for the address to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public HttpClientOptions proxy(@Nonnull InetSocketAddress connectAddress)
connectAddress - The proxy address to connect to.public HttpClientOptions proxy(@Nonnull InetSocketAddress connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
connectAddress - The address to connect to.username - The proxy username to use.password - A password-providing function for the proxy.public HttpClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
proxy in class ClientOptionstype - the proxy type.connectAddress - The address to connect to.public HttpClientOptions proxy(@Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
connectAddress - A supplier of the address to connect to.username - The proxy username to use.password - A password-providing function for the proxy.public HttpClientOptions resolver(AddressResolverGroup<?> resolver)
ClientOptionsAddressResolverGroup.resolver in class ClientOptionsresolver - the new AddressResolverGroupClientOptionspublic HttpClientOptions sslContext(SslContext sslContext)
NettyOptionsnull means
don't use SSL at all (the default).sslContext in class NettyOptions<Bootstrap,ClientOptions>sslContext - The context to set when configuring SSLpublic HttpClientOptions sslHandshakeTimeoutMillis(long sslHandshakeTimeoutMillis)
NettyOptionssslHandshakeTimeoutMillis in class NettyOptions<Bootstrap,ClientOptions>sslHandshakeTimeoutMillis - The timeout in millisecondspublic HttpClientOptions sslHandshakeTimeout(java.time.Duration sslHandshakeTimeout)
NettyOptionssslHandshakeTimeout in class NettyOptions<Bootstrap,ClientOptions>sslHandshakeTimeout - The timeout Durationpublic HttpClientOptions sslCloseNotifyFlushTimeout(java.time.Duration sslCloseNotifyFlushTimeout)
NettyOptionssslCloseNotifyFlushTimeout in class NettyOptions<Bootstrap,ClientOptions>sslCloseNotifyFlushTimeout - The timeout Durationpublic HttpClientOptions sslCloseNotifyFlushTimeoutMillis(long sslCloseNotifyFlushTimeoutMillis)
NettyOptionssslCloseNotifyFlushTimeoutMillis in class NettyOptions<Bootstrap,ClientOptions>sslCloseNotifyFlushTimeoutMillis - The timeout in millisecondspublic HttpClientOptions sslCloseNotifyReadTimeout(java.time.Duration sslCloseNotifyReadTimeout)
NettyOptionssslCloseNotifyReadTimeout in class NettyOptions<Bootstrap,ClientOptions>sslCloseNotifyReadTimeout - The timeout Durationpublic HttpClientOptions sslCloseNotifyReadTimeoutMillis(long sslCloseNotifyReadTimeoutMillis)
NettyOptionssslCloseNotifyReadTimeoutMillis in class NettyOptions<Bootstrap,ClientOptions>sslCloseNotifyReadTimeoutMillis - The timeout in millisecondspublic HttpClientOptions sslSupport()
ClientOptionssslSupport in class ClientOptionsClientOptionspublic HttpClientOptions sslSupport(java.util.function.Consumer<? super SslContextBuilder> configurator)
ClientOptionsSslContext to be passed to
NettyOptions.sslContext(SslContext).sslSupport in class ClientOptionsconfigurator - builder callback for further customization.ClientOptionsprotected SslContext defaultSslContext()
NettyOptionsdefaultSslContext in class NettyOptions<Bootstrap,ClientOptions>SslContext