Package org.apache.calcite.avatica.remote

# Class AvaticaCommonsHttpClientImpl

java.lang.Object
org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl

All Implemented Interfaces:
  `AvaticaHttpClient`, `GSSAuthenticateable`, `HttpClientPoolConfigurable`, `UsernamePasswordAuthenticateable`

public class AvaticaCommonsHttpClientImpl extends Object implements AvaticaHttpClient, HttpClientPoolConfigurable, UsernamePasswordAuthenticateable, GSSAuthenticateable
A common class to invoke HTTP requests against the Avatica server agnostic of the data being sent and received across the wire.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected org.apache.hc.client5.http.impl.auth.BasicAuthCache`
`authCache`
`protected org.apache.hc.core5.http.config.Lookup<org.apache.hc.client5.http.auth.AuthSchemeFactory>`
`authRegistry`
`protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient`
`client`
`protected org.apache.hc.client5.http.auth.UsernamePasswordCredentials`
`credentials`
`protected org.apache.hc.client5.http.auth.CredentialsProvider`
`credentialsProvider`
`protected org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager`
`pool`
`protected org.apache.hc.core5.http.config.Registry<org.apache.hc.client5.http.socket.ConnectionSocketFactory>`
`socketFactoryRegistry`
`protected final URI`
`uri`
`protected Object`
`userToken`

## Constructor Summary

Constructors
Constructor
Description
`AvaticaCommonsHttpClientImpl(URL url)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`initializeClient(org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager pool)`
`byte[]`
`send(byte[] request)`
Sends a serialized request to the Avatica server.
`void`
`setGSSCredential(GSSCredential credential)`
Sets the GSS Credential If credential is null, then the current subject will be used
`void`
`setHttpClientPool(org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager pool)`
Sets a PoolingHttpClientConnectionManager containing the collection of SSL/TLS server keys and truststores to use for HTTPS calls.
`void`
`setUsernamePassword(AuthenticationType authType, String username, String password)`
Sets the username, password and method to be used for authentication.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### uri

protected final URI uri

### authCache

protected org.apache.hc.client5.http.impl.auth.BasicAuthCache authCache

### client

protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient client

### socketFactoryRegistry

protected org.apache.hc.core5.http.config.Registry<org.apache.hc.client5.http.socket.ConnectionSocketFactory> socketFactoryRegistry

### pool

protected org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager pool

### credentials

protected org.apache.hc.client5.http.auth.UsernamePasswordCredentials credentials

### credentialsProvider

protected org.apache.hc.client5.http.auth.CredentialsProvider credentialsProvider

### authRegistry

protected org.apache.hc.core5.http.config.Lookup<org.apache.hc.client5.http.auth.AuthSchemeFactory> authRegistry

### userToken

protected Object userToken

## Constructor Details

### AvaticaCommonsHttpClientImpl

public AvaticaCommonsHttpClientImpl(URL url)

## Method Details

### initializeClient

protected void initializeClient(org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager pool)

### 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.

### setUsernamePassword

public void setUsernamePassword(AuthenticationType authType, String username, String password)
Description copied from interface: `UsernamePasswordAuthenticateable`
Sets the username, password and method to be used for authentication.

Specified by:
  `setUsernamePassword` in interface `UsernamePasswordAuthenticateable`
Parameters:
  `authType` - Type of authentication
  `username` - Username
  `password` - Password

### setGSSCredential

public void setGSSCredential(GSSCredential credential)
Description copied from interface: `GSSAuthenticateable`
Sets the GSS Credential If credential is null, then the current subject will be used

Specified by:
  `setGSSCredential` in interface `GSSAuthenticateable`
Parameters:
  `credential` - GSS Credentials

### setHttpClientPool

public void setHttpClientPool(org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager pool)
Description copied from interface: `HttpClientPoolConfigurable`
Sets a PoolingHttpClientConnectionManager containing the collection of SSL/TLS server keys and truststores to use for HTTPS calls.

Specified by:
  `setHttpClientPool` in interface `HttpClientPoolConfigurable`
Parameters:
  `pool` - The http connection pool