Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpConnectionManager


    public boolean interrupt() {
        HttpClient client = savedClient;
        if (client != null) {
            savedClient = null;
            // TODO - not sure this is the best method
            final HttpConnectionManager httpConnectionManager = client.getHttpConnectionManager();
            if (httpConnectionManager instanceof SimpleHttpConnectionManager) {// Should be true
                ((SimpleHttpConnectionManager)httpConnectionManager).shutdown();
            }
        }
        return client != null;
View Full Code Here


    try
    {
      method = createHttpMethod();
     
      // Create an instance of HttpClient.
      HttpConnectionManager manager = new SimpleHttpConnectionManager();
      HttpConnectionManagerParams params = new HttpConnectionManagerParams();
      params.setSoTimeout(HTTP_TIMEOUT_IN_MS);
      params.setConnectionTimeout(HTTP_CONNECTION_TIMEOUT_IN_MS);
      manager.setParams(params);
      HttpClient client = new HttpClient(manager);
     
      // Execute the method.      
      int statusCode = client.executeMethod(method);
     
View Full Code Here

      URL targetURL =
        new URL(msgContext.getStrProp(MessageContext.TRANS_URL));

      ProtocolFactory myFactory = (ProtocolFactory)msgContext.getProperty(SPSProxyHelper.PROTOCOL_FACTORY_PROPERTY);
      // Allow caller to override the connection manager that we use.
      HttpConnectionManager localConnectionManager = (HttpConnectionManager)msgContext.getProperty(SPSProxyHelper.CONNECTION_MANAGER_PROPERTY);
      if (localConnectionManager == null)
        localConnectionManager = connectionManager;

      // no need to retain these, as the cookies/credentials are
      // stored in the message context across multiple requests.
View Full Code Here

        if(binding.getUsername().equals("admin") == false && binding.getPassword().equals("admin")==false){
            googleService.setUserCredentials(binding.getUsername(),binding.getPassword());    
        }

        // Create an HTTP client
        HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.getParams().setDefaultMaxConnectionsPerHost(10);
        connectionManager.getParams().setConnectionTimeout(60000);
        httpClient = new HttpClient(connectionManager);
    }
View Full Code Here

     * held open. This is an optional method, and callers are not expected to
     * call it, but can if they want to explicitly release any open resources.
     * Once a client has been shutdown, it cannot be used to make more requests.
     */
    public void shutdown() {
        HttpConnectionManager connectionManager = httpClient.getHttpConnectionManager();
        if (connectionManager instanceof MultiThreadedHttpConnectionManager) {
            ((MultiThreadedHttpConnectionManager)connectionManager).shutdown();
        }
    }
View Full Code Here

            if (httpClient != null) {
                return httpClient;
            }

            HttpConnectionManager connManager = (HttpConnectionManager) msgContext
                    .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
            if (connManager == null) {
                connManager = (HttpConnectionManager) msgContext
                        .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
            }
View Full Code Here

        // This is needed as by default there are 2 parallel
        // connections to some host and there is nothing that
        // closes the http connection here.
        // Need to set the httpConnectionManager
        HttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(5);
        context.getComponent("http", HttpComponent.class).setHttpConnectionManager(httpConnectionManager);
      

        String endpointName = "seda:withoutConversion?concurrentConsumers=5";
        sendMessagesTo(endpointName, 5);
View Full Code Here

      URL targetURL =
        new URL(msgContext.getStrProp(MessageContext.TRANS_URL));

      ProtocolFactory myFactory = (ProtocolFactory)msgContext.getProperty(SPSProxyHelper.PROTOCOL_FACTORY_PROPERTY);
      // Allow caller to override the connection manager that we use.
      HttpConnectionManager localConnectionManager = (HttpConnectionManager)msgContext.getProperty(SPSProxyHelper.CONNECTION_MANAGER_PROPERTY);
      if (localConnectionManager == null)
        localConnectionManager = connectionManager;

      // no need to retain these, as the cookies/credentials are
      // stored in the message context across multiple requests.
View Full Code Here

    try {
      URL targetURL =
        new URL(msgContext.getStrProp(MessageContext.TRANS_URL));

      ConnectionConfig configInfo = (ConnectionConfig)msgContext.getProperty(MeridioWrapper.CONFIGURATION_PROPERTY);
      HttpConnectionManager localConnectionManager = configInfo.getConnectionManager();
      if (localConnectionManager == null)
        localConnectionManager = connectionManager;

      // no need to retain these, as the cookies/credentials are
      // stored in the message context across multiple requests.
View Full Code Here

        HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
        // setup the httpConnectionManagerParams
        IntrospectionSupport.setProperties(connectionManagerParams, parameters, "httpConnectionManager.");
        validateParameters(uri, parameters, "httpConnectionManager.");
        // make sure the component httpConnectionManager is take effect
        HttpConnectionManager thisHttpConnectionManager = httpConnectionManager;
        if (thisHttpConnectionManager == null) {
            // only set the params on the new created http connection manager
            thisHttpConnectionManager = new MultiThreadedHttpConnectionManager();
            thisHttpConnectionManager.setParams(connectionManagerParams);
        }
        // create the configurer to use for this endpoint (authMethods contains the used methods created by the configurer)
        final Set<AuthMethod> authMethods = new LinkedHashSet<AuthMethod>();
        HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods);
        addressUri = UnsafeUriCharactersEncoder.encodeHttpURI(addressUri);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HttpConnectionManager

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.