Class AvaticaCommonsHttpClientImpl

    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • MAX_POOLED_CONNECTION_PER_ROUTE_KEY

        private static final java.lang.String MAX_POOLED_CONNECTION_PER_ROUTE_KEY
        See Also:
        Constant Field Values
      • MAX_POOLED_CONNECTION_PER_ROUTE_DEFAULT

        private static final java.lang.String MAX_POOLED_CONNECTION_PER_ROUTE_DEFAULT
        See Also:
        Constant Field Values
      • MAX_POOLED_CONNECTIONS_KEY

        private static final java.lang.String MAX_POOLED_CONNECTIONS_KEY
        See Also:
        Constant Field Values
      • MAX_POOLED_CONNECTIONS_DEFAULT

        private static final java.lang.String MAX_POOLED_CONNECTIONS_DEFAULT
        See Also:
        Constant Field Values
      • host

        protected final org.apache.http.HttpHost host
      • uri

        protected final java.net.URI uri
      • authCache

        protected org.apache.http.impl.client.BasicAuthCache authCache
      • client

        protected org.apache.http.impl.client.CloseableHttpClient client
      • socketFactoryRegistry

        protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> socketFactoryRegistry
      • pool

        protected org.apache.http.impl.conn.PoolingHttpClientConnectionManager pool
      • credentials

        protected org.apache.http.auth.UsernamePasswordCredentials credentials
      • credentialsProvider

        protected org.apache.http.client.CredentialsProvider credentialsProvider
      • authRegistry

        protected org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authRegistry
      • userToken

        protected java.lang.Object userToken
      • truststore

        protected java.io.File truststore
      • keystore

        protected java.io.File keystore
      • truststorePassword

        protected java.lang.String truststorePassword
      • keystorePassword

        protected java.lang.String keystorePassword
      • keyPassword

        protected java.lang.String keyPassword
    • Constructor Detail

      • AvaticaCommonsHttpClientImpl

        public AvaticaCommonsHttpClientImpl​(java.net.URL url)
    • Method Detail

      • initializeClient

        private void initializeClient()
      • configureConnectionPool

        protected void configureConnectionPool​(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry)
      • configureSocketFactories

        protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> configureSocketFactories()
      • configureHttpsRegistry

        protected void configureHttpsRegistry​(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder)
      • getSSLContext

        private javax.net.ssl.SSLContext getSSLContext()
                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadKeyStore

        protected void loadKeyStore​(org.apache.http.ssl.SSLContextBuilder sslContextBuilder)
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadTrustStore

        protected void loadTrustStore​(org.apache.http.ssl.SSLContextBuilder sslContextBuilder)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • configureHttpRegistry

        protected void configureHttpRegistry​(org.apache.http.config.RegistryBuilder<org.apache.http.conn.socket.ConnectionSocketFactory> registryBuilder)
      • getHostnameVerifier

        javax.net.ssl.HostnameVerifier getHostnameVerifier​(HostnameVerificationConfigurable.HostnameVerification verification)
        Creates the HostnameVerifier given the provided verification.
        Parameters:
        verification - The intended hostname verification action.
        Returns:
        A verifier for the request verification.
        Throws:
        java.lang.IllegalArgumentException - if the provided verification cannot be handled.
      • send

        public byte[] send​(byte[] request)
        Description copied from interface: AvaticaHttpClient
        Sends a serialized request to the Avatica server.
        Specified by:
        send in interface AvaticaHttpClient
        Parameters:
        request - The serialized request.
        Returns:
        The serialized response.
      • execute

        org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpPost post,
                                                                     org.apache.http.client.protocol.HttpClientContext context)
                                                              throws java.io.IOException,
                                                                     org.apache.http.client.ClientProtocolException
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • toURI

        private static java.net.URI toURI​(java.net.URL url)
                                   throws java.lang.RuntimeException
        Throws:
        java.lang.RuntimeException
      • setTrustStore

        public void setTrustStore​(java.io.File truststore,
                                  java.lang.String password)
        Description copied from interface: TrustStoreConfigurable
        Sets a truststore containing the collection of trust SSL/TLS server certificates to use for HTTPS calls and the password for that truststore.
        Specified by:
        setTrustStore in interface TrustStoreConfigurable
        Parameters:
        truststore - The truststore on the local filesystem
        password - The truststore's password
      • setKeyStore

        public void setKeyStore​(java.io.File keystore,
                                java.lang.String keystorepassword,
                                java.lang.String keypassword)
        Description copied from interface: KeyStoreConfigurable
        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
        Specified by:
        setKeyStore in interface KeyStoreConfigurable
        Parameters:
        keystore - The keystore on the local filesystem
        keystorepassword - The keystore's password
        keypassword - The key's password