public class HttpConnection
extends java.lang.Object
implements java.lang.AutoCloseable
HttpConnection class provides an SSL communication layer for Channel requests.
Allowed certificates, which are used for HTTPS certificate validation, are given in a file which name is set in the
constructor HttpConnection(String, boolean, HttpProxySettings).| Constructor and Description |
|---|
HttpConnection(java.lang.String verifyCertBundle,
boolean isHttps,
HttpProxySettings httpProxySettings) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the request object and its supporting HttpClient.
|
org.apache.http.client.methods.CloseableHttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase httpRequestBase)
Execute the HTTP Request
|
void |
resetCookies()
Clean up session data which are sent in all requests, e.g.: delete cookies from HttpClientContext CookieStore
|
public HttpConnection(java.lang.String verifyCertBundle,
boolean isHttps,
HttpProxySettings httpProxySettings)
throws java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.KeyManagementException,
java.io.IOException
verifyCertBundle - CA Bundle chain certificates. This string shall be either the certificates themselves or
a path to a CA bundle file containing those certificates. The CA bundle is used to
validate that the certificate of the authentication server being connected to was signed
by a valid authority. If set to an empty string, the server certificate will not be
validated.isHttps - set to true if the connection requires SSL, false otherwisehttpProxySettings - contains http proxy url, port, username and passwordjava.security.KeyManagementException - If initialization of SSL context failsjava.security.KeyStoreException - If there is an error creating a key store from the certificates in the
trust store filejava.security.cert.CertificateException - If there is an error creating a certificate from the certificates in the
trust store filejava.security.NoSuchAlgorithmException - If there is an error creating a certificate factoryjava.io.IOException - If there is an error creating a key store from the certificates in
the trust store filepublic org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpRequestBase httpRequestBase)
throws java.io.IOException,
org.apache.http.client.ClientProtocolException
httpRequestBase - http request to be executedjava.io.IOException - in case of a problem or the connection was abortedorg.apache.http.client.ClientProtocolException - in case of an http protocol errorpublic void resetCookies()
public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException