public class HttpUtils extends Object
http://www.browserscope.org/?category=network
,
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_KEEP_ALIVE_SECONDS |
static int |
MAX_CONNECTIONS
The maximum number of connections allowed in total by the HttpClient
|
static int |
MAX_CONNECTIONS_PER_ROUTE
The number of parallel connections allowed per route / server
Use caution resetting this one: more is not better:
|
static boolean |
MONITOR_IDLE_THREADS |
static String |
SCHEME_NAME |
Constructor and Description |
---|
HttpUtils() |
Modifier and Type | Method and Description |
---|---|
static org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
buildConnectionRegistry() |
static org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
buildConnectionRegistry(X509Session x509Session) |
static org.apache.http.conn.ConnectionKeepAliveStrategy |
buildD1KeepAliveStrategy(long defaultKeepAliveTimeout)
Builds a custom keep-alive strategy that uses the defaultKeepAliveTimeout
value if one not returned in the response headers.
|
static org.apache.http.client.HttpClient |
createHttpClient(String authToken)
Creates an HttpClient configured with the authorization token credentials.
|
static org.apache.http.client.HttpClient |
createHttpClient(X509Session x509session)
Creates an HttpClient configured with the X509 credentials.
|
static org.apache.http.impl.client.HttpClientBuilder |
getHttpClientBuilder(String authToken)
Returns an HttpClientBuilder with the DataONE-standard ConnectionManager configuration specified.
|
static org.apache.http.impl.client.HttpClientBuilder |
getHttpClientBuilder(X509Session x509session)
Returns an HttpClientBuilder with the DataONE-standard ConnectionManager configuration
specified.
|
static X509Session |
selectSession(String subjectString) |
static void |
setupSSL_v4_1(org.apache.http.impl.client.AbstractHttpClient httpClient,
X509Session x509Session)
Provided to assist with backwards compatibility with v4.1.x era DefaultHttpClient
(now deprecated).
|
public static final String SCHEME_NAME
public static final boolean MONITOR_IDLE_THREADS
public static final int MAX_CONNECTIONS
public static final int MAX_CONNECTIONS_PER_ROUTE
https://redmine.dataone.org/issues/7463#note-1
public static final long DEFAULT_KEEP_ALIVE_SECONDS
public static void setupSSL_v4_1(org.apache.http.impl.client.AbstractHttpClient httpClient, X509Session x509Session)
session
- public static org.apache.http.client.HttpClient createHttpClient(X509Session x509session) throws UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, InstantiationException, IllegalAccessException, IOException, org.jibx.runtime.JiBXException
x509session
- - - the configuration object containing the X509 client certificate used for the connectionsUnrecoverableKeyException
KeyManagementException
NoSuchAlgorithmException
KeyStoreException
CertificateException
InstantiationException
IllegalAccessException
IOException
org.jibx.runtime.JiBXException
public static org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilder(X509Session x509session) throws UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, InstantiationException, IllegalAccessException, IOException, org.jibx.runtime.JiBXException
x509session
- - the configuration object containing the X509 client certificate used for the connectionsUnrecoverableKeyException
KeyManagementException
NoSuchAlgorithmException
KeyStoreException
CertificateException
InstantiationException
IllegalAccessException
IOException
org.jibx.runtime.JiBXException
public static org.apache.http.client.HttpClient createHttpClient(String authToken)
authToken
- - the configuration object containing the authorization token string used for the connectionspublic static org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilder(String authToken)
authToken
- - the configuration object containing the authorization token string used for the connectionspublic static X509Session selectSession(String subjectString) throws IOException
IOException
public static org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> buildConnectionRegistry(X509Session x509Session) throws UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
public static org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> buildConnectionRegistry()
public static org.apache.http.conn.ConnectionKeepAliveStrategy buildD1KeepAliveStrategy(long defaultKeepAliveTimeout)
defaultKeepAliveTimeout
- - number of seconds (to match units of the keep-alive timeout header)Copyright © 2016. All Rights Reserved.