public class AvaticaCommonsHttpClientImpl extends Object implements AvaticaHttpClient, UsernamePasswordAuthenticateable, TrustStoreConfigurable, KeyStoreConfigurable, HostnameVerificationConfigurable
HostnameVerificationConfigurable.HostnameVerification
Modifier and Type | Field and Description |
---|---|
protected org.apache.http.impl.client.BasicAuthCache |
authCache |
protected org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> |
authRegistry |
protected org.apache.http.impl.client.CloseableHttpClient |
client |
protected org.apache.http.auth.UsernamePasswordCredentials |
credentials |
protected org.apache.http.client.CredentialsProvider |
credentialsProvider |
protected org.apache.http.HttpHost |
host |
protected HostnameVerificationConfigurable.HostnameVerification |
hostnameVerification |
protected String |
keyPassword |
protected File |
keystore |
protected String |
keystorePassword |
protected org.apache.http.impl.conn.PoolingHttpClientConnectionManager |
pool |
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
socketFactoryRegistry |
protected File |
truststore |
protected String |
truststorePassword |
protected URI |
uri |
protected Object |
userToken |
Constructor and Description |
---|
AvaticaCommonsHttpClientImpl(URL url) |
Modifier and Type | Method and Description |
---|---|
protected void |
configureConnectionPool(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry) |
protected void |
configureHttpRegistry(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder) |
protected void |
configureHttpsRegistry(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder) |
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
configureSocketFactories() |
protected void |
loadKeyStore(org.apache.http.ssl.SSLContextBuilder sslContextBuilder) |
protected void |
loadTrustStore(org.apache.http.ssl.SSLContextBuilder sslContextBuilder) |
byte[] |
send(byte[] request)
Sends a serialized request to the Avatica server.
|
void |
setHostnameVerification(HostnameVerificationConfigurable.HostnameVerification verification)
Instructs the
AvaticaHttpClient how to perform hostname verification for SSL
connections. |
void |
setKeyStore(File keystore,
String keystorepassword,
String keypassword)
Sets a keystore containing the collection of client side certificates
to use for HTTPS mutual authentication along with
password for keystore and password for key
|
void |
setTrustStore(File truststore,
String password)
Sets a truststore containing the collection of trust SSL/TLS server certificates
to use for HTTPS calls and the password for that truststore.
|
void |
setUsernamePassword(AuthenticationType authType,
String username,
String password)
Sets the username, password and method to be used for authentication.
|
protected final org.apache.http.HttpHost host
protected final URI uri
protected org.apache.http.impl.client.BasicAuthCache authCache
protected org.apache.http.impl.client.CloseableHttpClient client
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> socketFactoryRegistry
protected org.apache.http.impl.conn.PoolingHttpClientConnectionManager pool
protected org.apache.http.auth.UsernamePasswordCredentials credentials
protected org.apache.http.client.CredentialsProvider credentialsProvider
protected org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authRegistry
protected Object userToken
protected File truststore
protected File keystore
protected String truststorePassword
protected String keystorePassword
protected String keyPassword
protected HostnameVerificationConfigurable.HostnameVerification hostnameVerification
public AvaticaCommonsHttpClientImpl(URL url)
protected void configureConnectionPool(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry)
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> configureSocketFactories()
protected void configureHttpsRegistry(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder)
protected void loadKeyStore(org.apache.http.ssl.SSLContextBuilder sslContextBuilder) throws Exception
Exception
protected void loadTrustStore(org.apache.http.ssl.SSLContextBuilder sslContextBuilder) throws Exception
Exception
protected void configureHttpRegistry(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder)
public byte[] send(byte[] request)
AvaticaHttpClient
send
in interface AvaticaHttpClient
request
- The serialized request.public void setUsernamePassword(AuthenticationType authType, String username, String password)
UsernamePasswordAuthenticateable
setUsernamePassword
in interface UsernamePasswordAuthenticateable
authType
- Type of authenticationusername
- Usernamepassword
- Passwordpublic void setTrustStore(File truststore, String password)
TrustStoreConfigurable
setTrustStore
in interface TrustStoreConfigurable
truststore
- The truststore on the local filesystempassword
- The truststore's passwordpublic void setKeyStore(File keystore, String keystorepassword, String keypassword)
KeyStoreConfigurable
setKeyStore
in interface KeyStoreConfigurable
keystore
- The keystore on the local filesystemkeystorepassword
- The keystore's passwordkeypassword
- The key's passwordpublic void setHostnameVerification(HostnameVerificationConfigurable.HostnameVerification verification)
HostnameVerificationConfigurable
AvaticaHttpClient
how to perform hostname verification for SSL
connections.setHostnameVerification
in interface HostnameVerificationConfigurable
verification
- The mode of hostname verificationCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.