Class DefaultHttpClientConnectionOperator
- java.lang.Object
-
- org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator
-
- All Implemented Interfaces:
HttpClientConnectionOperator
@Internal @Contract(threading=STATELESS) public class DefaultHttpClientConnectionOperator extends java.lang.Object implements HttpClientConnectionOperator
Default implementation ofHttpClientConnectionOperatorused as default in Http client, when no instance provided by user toBasicHttpClientConnectionManagerorPoolingHttpClientConnectionManagerconstructor.- Since:
- 4.4
-
-
Field Summary
Fields Modifier and Type Field Description private DetachedSocketFactorydetachedSocketFactoryprivate DnsResolverdnsResolverprivate static org.slf4j.LoggerLOG(package private) static DetachedSocketFactoryPLAIN_SOCKET_FACTORYprivate SchemePortResolverschemePortResolverprivate static booleanSUPPORTS_KEEPALIVE_OPTIONSprivate org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy>tlsSocketStrategyLookupprivate UnixDomainSocketFactoryunixDomainSocketFactory
-
Constructor Summary
Constructors Constructor Description DefaultHttpClientConnectionOperator(DetachedSocketFactory detachedSocketFactory, SchemePortResolver schemePortResolver, DnsResolver dnsResolver, org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> tlsSocketStrategyLookup)DefaultHttpClientConnectionOperator(SchemePortResolver schemePortResolver, DnsResolver dnsResolver, org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> tlsSocketStrategyLookup)DefaultHttpClientConnectionOperator(org.apache.hc.core5.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry, SchemePortResolver schemePortResolver, DnsResolver dnsResolver)Deprecated.Do not use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) static org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy>adapt(org.apache.hc.core5.http.config.Lookup<ConnectionSocketFactory> lookup)Deprecated.Provided for backward compatibilityprivate static voidconfigureSocket(java.net.Socket socket, org.apache.hc.core5.http.io.SocketConfig socketConfig, boolean isTcp)voidconnect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.TimeValue connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, org.apache.hc.core5.http.protocol.HttpContext context)Connect the given managed connection to the remote endpoint.voidconnect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)Connect the given managed connection to the remote endpoint.voidconnect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.nio.file.Path unixDomainSocket, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)Connect the given managed connection to the remote endpoint.private voidconnectToUnixDomainSocket(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.lang.Object attachment, java.nio.file.Path unixDomainSocket, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, org.apache.hc.core5.http.protocol.HttpContext context)protected voidonAfterSocketConnect(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)protected voidonAfterTlsHandshake(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)protected voidonBeforeSocketConnect(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)protected voidonBeforeTlsHandshake(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)voidupgrade(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.protocol.HttpContext context)Upgrades transport security of the given managed connection by using the TLS security protocol.voidupgrade(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)Upgrades transport security of the given managed connection by using the TLS security protocol.private voidupgradeToTls(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, org.apache.hc.core5.util.Timeout connectTimeout, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context, TlsSocketStrategy tlsSocketStrategy, java.net.Socket socket)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
SUPPORTS_KEEPALIVE_OPTIONS
private static final boolean SUPPORTS_KEEPALIVE_OPTIONS
-
PLAIN_SOCKET_FACTORY
static final DetachedSocketFactory PLAIN_SOCKET_FACTORY
-
detachedSocketFactory
private final DetachedSocketFactory detachedSocketFactory
-
unixDomainSocketFactory
private final UnixDomainSocketFactory unixDomainSocketFactory
-
tlsSocketStrategyLookup
private final org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> tlsSocketStrategyLookup
-
schemePortResolver
private final SchemePortResolver schemePortResolver
-
dnsResolver
private final DnsResolver dnsResolver
-
-
Constructor Detail
-
DefaultHttpClientConnectionOperator
public DefaultHttpClientConnectionOperator(DetachedSocketFactory detachedSocketFactory, SchemePortResolver schemePortResolver, DnsResolver dnsResolver, org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> tlsSocketStrategyLookup)
-
DefaultHttpClientConnectionOperator
@Deprecated public DefaultHttpClientConnectionOperator(org.apache.hc.core5.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry, SchemePortResolver schemePortResolver, DnsResolver dnsResolver)
Deprecated.Do not use.
-
DefaultHttpClientConnectionOperator
public DefaultHttpClientConnectionOperator(SchemePortResolver schemePortResolver, DnsResolver dnsResolver, org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> tlsSocketStrategyLookup)
-
-
Method Detail
-
adapt
@Deprecated static org.apache.hc.core5.http.config.Lookup<TlsSocketStrategy> adapt(org.apache.hc.core5.http.config.Lookup<ConnectionSocketFactory> lookup)
Deprecated.Provided for backward compatibility
-
connect
public void connect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.TimeValue connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
Description copied from interface:HttpClientConnectionOperatorConnect the given managed connection to the remote endpoint.- Specified by:
connectin interfaceHttpClientConnectionOperator- Parameters:
conn- the managed connection.host- the address of the opposite endpoint.localAddress- the address of the local endpoint.connectTimeout- the timeout of the connect operation.socketConfig- the socket configuration.context- the execution context.- Throws:
java.io.IOException
-
connect
public void connect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
Description copied from interface:HttpClientConnectionOperatorConnect the given managed connection to the remote endpoint.- Specified by:
connectin interfaceHttpClientConnectionOperator- Parameters:
conn- the managed connection.endpointHost- the address of the remote endpoint.endpointName- the name of the remote endpoint, if different from the endpoint host name,nullotherwise. Usually taken from the request URU authority.localAddress- the address of the local endpoint.connectTimeout- the timeout of the connect operation.socketConfig- the socket configuration.attachment- connect request attachment.context- the execution context.- Throws:
java.io.IOException
-
connect
public void connect(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.nio.file.Path unixDomainSocket, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
Description copied from interface:HttpClientConnectionOperatorConnect the given managed connection to the remote endpoint.- Specified by:
connectin interfaceHttpClientConnectionOperator- Parameters:
conn- the managed connection.endpointHost- the address of the remote endpoint.endpointName- the name of the remote endpoint, if different from the endpoint host name,nullotherwise. Usually taken from the request URU authority.unixDomainSocket- the path to the Unix domain socket, ornullif none.localAddress- the address of the local endpoint.connectTimeout- the timeout of the connect operation.socketConfig- the socket configuration.attachment- connect request attachment.context- the execution context.- Throws:
java.io.IOException
-
upgradeToTls
private void upgradeToTls(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, org.apache.hc.core5.util.Timeout connectTimeout, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context, TlsSocketStrategy tlsSocketStrategy, java.net.Socket socket) throws java.io.IOException
- Throws:
java.io.IOException
-
connectToUnixDomainSocket
private void connectToUnixDomainSocket(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.lang.Object attachment, java.nio.file.Path unixDomainSocket, org.apache.hc.core5.util.Timeout connectTimeout, org.apache.hc.core5.http.io.SocketConfig socketConfig, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
- Throws:
java.io.IOException
-
configureSocket
private static void configureSocket(java.net.Socket socket, org.apache.hc.core5.http.io.SocketConfig socketConfig, boolean isTcp) throws java.io.IOException- Throws:
java.io.IOException
-
upgrade
public void upgrade(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
Description copied from interface:HttpClientConnectionOperatorUpgrades transport security of the given managed connection by using the TLS security protocol.- Specified by:
upgradein interfaceHttpClientConnectionOperator- Parameters:
conn- the managed connection.host- the address of the opposite endpoint with TLS security.context- the execution context.- Throws:
java.io.IOException
-
upgrade
public void upgrade(ManagedHttpClientConnection conn, org.apache.hc.core5.http.HttpHost endpointHost, org.apache.hc.core5.net.NamedEndpoint endpointName, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOException
Description copied from interface:HttpClientConnectionOperatorUpgrades transport security of the given managed connection by using the TLS security protocol.- Specified by:
upgradein interfaceHttpClientConnectionOperator- Parameters:
conn- the managed connection.endpointHost- the address of the remote endpoint.endpointName- the name of the remote endpoint, if different from the endpoint host name,nullotherwise. Usually taken from the request URU authority.attachment- connect request attachment.context- the execution context.- Throws:
java.io.IOException
-
onBeforeSocketConnect
protected void onBeforeSocketConnect(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)
-
onAfterSocketConnect
protected void onAfterSocketConnect(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)
-
onBeforeTlsHandshake
protected void onBeforeTlsHandshake(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)
-
onAfterTlsHandshake
protected void onAfterTlsHandshake(org.apache.hc.core5.http.protocol.HttpContext httpContext, org.apache.hc.core5.http.HttpHost endpointHost)
-
-