Package org.apache.commons.httpclient.params

Examples of org.apache.commons.httpclient.params.HttpConnectionManagerParams


            http = new HttpClient(m);
        } else {
            m = http.getHttpConnectionManager();
        }

        HttpConnectionManagerParams mp = m.getParams();
        if (config.getMaxConnections() != null) {
          mp.setMaxTotalConnections(config.getMaxConnections());
          mp.setMaxConnectionsPerHost(HostConfiguration.ANY_HOST_CONFIGURATION, config.getMaxConnections());
        }

        HttpClientParams cp = http.getParams();
        if (config.getTimeout() != null) {
            mp.setConnectionTimeout(config.getTimeout().intValue());
            cp.setConnectionManagerTimeout(config.getTimeout());
            cp.setSoTimeout(config.getTimeout().intValue());
        }
        if (config.getRetryHandler() != null) {
            cp.setParameter(HttpMethodParams.RETRY_HANDLER, config.getRetryHandler());
View Full Code Here


        HostConfiguration hostConfig = new HostConfiguration();
        hostConfig.setHost( uri.getHost() );

        int maxHostConnections = 20;

        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
        params.setMaxConnectionsPerHost( hostConfig, maxHostConnections );

        HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.setParams( params );

        org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient(
View Full Code Here

                Utils.createSimpleServiceforClient(serviceName,
                                                   Echo.class.getName(),
                                                   operationName);

        MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
        // Maximum one socket connection to a specific host
        connectionManagerParams.setDefaultMaxConnectionsPerHost(1);
        connectionManagerParams.setTcpNoDelay(true);
        connectionManagerParams.setStaleCheckingEnabled(true);
        connectionManagerParams.setLinger(0);
        connectionManager.setParams(connectionManagerParams);

        HttpClient httpClient = new HttpClient(connectionManager);

        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
View Full Code Here

            throw new RepositoryException(e);
        }

        connectionManager = new MultiThreadedHttpConnectionManager();
        if (maximumHttpConnections > 0) {
            HttpConnectionManagerParams connectionParams = connectionManager.getParams();
            connectionParams.setDefaultMaxConnectionsPerHost(maximumHttpConnections);
            connectionParams.setMaxTotalConnections(maximumHttpConnections);
        }

        // This configuration of the clients cache assumes that the level of
        // concurrency on this map will be equal to the default number of maximum
        // connections allowed on the httpClient level.
View Full Code Here

        clientParams.setAuthenticationPreemptive(isPreemptiveAuthentication());
        clientParams.setContentCharset(getContentCharSet());
        clientParams.setParameter(HttpClientParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(
                connectionRetryAttempts, false));

        HttpConnectionManagerParams connMgrParams = new HttpConnectionManagerParams();
        connMgrParams.setConnectionTimeout(getConnectionTimeout());
        connMgrParams.setDefaultMaxConnectionsPerHost(getMaxConnectionsPerHost());
        connMgrParams.setMaxTotalConnections(getMaxTotalConnections());
        connMgrParams.setReceiveBufferSize(getReceiveBufferSize());
        connMgrParams.setSendBufferSize(getSendBufferSize());
        connMgrParams.setTcpNoDelay(isTcpNoDelay());

        MultiThreadedHttpConnectionManager connMgr = new MultiThreadedHttpConnectionManager();
        connMgr.setParams(connMgrParams);

        HttpClient httpClient = new HttpClient(clientParams, connMgr);
View Full Code Here

            }
        }
        // Create client
        if (client == null) {
            connectionManager = new MultiThreadedHttpConnectionManager();
            HttpConnectionManagerParams params = new HttpConnectionManagerParams();
            params.setDefaultMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
            params.setMaxTotalConnections(configuration.getMaxTotalConnections());
            connectionManager.setParams(params);
            client = new HttpClient(connectionManager);
        }
        // Create connectionPool
        if (connectionPool == null) {
View Full Code Here

        /* Set host configuration */
        HostConfiguration hostConfiguration = new HostConfiguration();

        /* Set connection manager parameters */
        HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
        connectionManagerParams.setConnectionTimeout(config.getConnectionTimeout());
        connectionManagerParams.setSoTimeout(config.getSocketTimeout());
        connectionManagerParams.setStaleCheckingEnabled(true);
        connectionManagerParams.setTcpNoDelay(true);
        connectionManagerParams.setMaxTotalConnections(config.getMaxConnections());
        connectionManagerParams.setMaxConnectionsPerHost(hostConfiguration, config.getMaxConnections());

        int socketSendBufferSizeHint = config.getSocketBufferSizeHints()[0];
        if (socketSendBufferSizeHint > 0) {
            connectionManagerParams.setSendBufferSize(socketSendBufferSizeHint);
        }

        int socketReceiveBufferSizeHint = config.getSocketBufferSizeHints()[1];
        if (socketReceiveBufferSizeHint > 0) {
            connectionManagerParams.setReceiveBufferSize(socketReceiveBufferSizeHint);
        }

        /* Set connection manager */
        MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.setParams(connectionManagerParams);
View Full Code Here

            throw new RepositoryException(e);
        }

        connectionManager = new MultiThreadedHttpConnectionManager();
        if (maximumHttpConnections > 0) {
            HttpConnectionManagerParams connectionParams = connectionManager.getParams();
            connectionParams.setDefaultMaxConnectionsPerHost(maximumHttpConnections);
            connectionParams.setMaxTotalConnections(maximumHttpConnections);
        }

        // This configuration of the clients cache assumes that the level of
        // concurrency on this map will be equal to the default number of maximum
        // connections allowed on the httpClient level.
View Full Code Here

        }
    }

    private void initHttpConnectionManagerParams(HTTPConnectionManagerSettings settings)
    {
        connectionParams = new HttpConnectionManagerParams();
        connectionParams.setMaxTotalConnections(settings.getMaxTotalConnections());
        connectionParams.setDefaultMaxConnectionsPerHost(settings.getDefaultMaxConnectionsPerHost());

        if (!settings.getCookiePolicy().equals(CookiePolicy.DEFAULT))
        {
View Full Code Here

            }
        });
       
       
        // Set connection parameters.
        HttpConnectionManagerParams connectionParams = new HttpConnectionManagerParams();
        connectionParams.setConnectionTimeout(HTTP_CONNECTION_TIMEOUT);
        connectionParams.setSoTimeout(SOCKET_CONNECTION_TIMEOUT);       
        connectionParams.setStaleCheckingEnabled(false);
       
        HttpClient httpClient = new HttpClient(clientParams);
        httpClient.getHttpConnectionManager().setParams(connectionParams);
        return httpClient;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.params.HttpConnectionManagerParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.