Example usage for org.apache.commons.httpclient.params HttpClientParams CONNECTION_MANAGER_CLASS

List of usage examples for org.apache.commons.httpclient.params HttpClientParams CONNECTION_MANAGER_CLASS

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.params HttpClientParams CONNECTION_MANAGER_CLASS.

Prototype

String CONNECTION_MANAGER_CLASS

To view the source code for org.apache.commons.httpclient.params HttpClientParams CONNECTION_MANAGER_CLASS.

Click Source Link

Usage

From source file:org.kuali.rice.kew.config.ThinClientResourceLoader.java

protected void configureDefaultHttpClientParams(HttpParams params) {
    params.setParameter(HttpClientParams.CONNECTION_MANAGER_CLASS, MultiThreadedHttpConnectionManager.class);
    params.setParameter(HttpMethodParams.COOKIE_POLICY, CookiePolicy.RFC_2109);
    params.setLongParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT,
            new Long(DEFAULT_CONNECTION_MANAGER_TIMEOUT));
    Map<HostConfiguration, Integer> maxHostConnectionsMap = new HashMap<HostConfiguration, Integer>();
    maxHostConnectionsMap.put(HostConfiguration.ANY_HOST_CONFIGURATION, new Integer(DEFAULT_MAX_CONNECTIONS));
    params.setParameter(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, maxHostConnectionsMap);
    params.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,
            new Integer(DEFAULT_MAX_CONNECTIONS));
    params.setIntParameter(HttpConnectionManagerParams.CONNECTION_TIMEOUT,
            new Integer(DEFAULT_CONNECTION_TIMEOUT));

    boolean retrySocketException = new Boolean(
            ConfigContext.getCurrentContextConfig().getProperty(RETRY_SOCKET_EXCEPTION_PROPERTY));
    if (retrySocketException) {
        LOG.info("Installing custom HTTP retry handler to retry requests in face of SocketExceptions");
        params.setParameter(HttpMethodParams.RETRY_HANDLER, new CustomHttpMethodRetryHandler());
    }/*from  w w w  .j a  v  a  2  s  .com*/
}

From source file:org.kuali.rice.ksb.messaging.serviceconnectors.HttpInvokerConnector.java

protected void configureDefaultHttpClientParams(HttpParams params) {
    params.setParameter(HttpClientParams.CONNECTION_MANAGER_CLASS, MultiThreadedHttpConnectionManager.class);
    params.setParameter(HttpMethodParams.COOKIE_POLICY, CookiePolicy.RFC_2109);
    params.setLongParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, 10000);
    Map<HostConfiguration, Integer> maxHostConnectionsMap = new HashMap<HostConfiguration, Integer>();
    maxHostConnectionsMap.put(HostConfiguration.ANY_HOST_CONFIGURATION, new Integer(20));
    params.setParameter(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, maxHostConnectionsMap);
    params.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 20);
    params.setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 10000);
    params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, 2 * 60 * 1000);

    boolean retrySocketException = new Boolean(
            ConfigContext.getCurrentContextConfig().getProperty(RETRY_SOCKET_EXCEPTION_PROPERTY));
    if (retrySocketException) {
        LOG.info("Installing custom HTTP retry handler to retry requests in face of SocketExceptions");
        params.setParameter(HttpMethodParams.RETRY_HANDLER, new CustomHttpMethodRetryHandler());
    }//from   w w  w  . ja  v a2s  . c  om

}