Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.SimpleHttpConnectionManager


    this(150, 2000, 2000, 1024 * 1024);
  }

  public HttpClient(int maxConPerHost, int conTimeOutMs, int soTimeOutMs,
      int maxSize) {
    connectionManager = new SimpleHttpConnectionManager();
    HttpConnectionManagerParams params = connectionManager.getParams();
    params.setDefaultMaxConnectionsPerHost(maxConPerHost);
    params.setConnectionTimeout(conTimeOutMs);
    params.setSoTimeout(soTimeOutMs);

View Full Code Here


        // N.B. HostConfiguration.equals() includes proxy settings in the compare.
        HttpClient httpClient = map.get(hc);

        if ( httpClient == null )
        {
            httpClient = new HttpClient(new SimpleHttpConnectionManager());
            if (log.isDebugEnabled()) {
                log.debug("Created new HttpClient: @"+System.identityHashCode(httpClient));
            }
            httpClient.setHostConfiguration(hc);
            map.put(hc, httpClient);
View Full Code Here

        // N.B. HostConfiguration.equals() includes proxy settings in the compare.
        HttpClient httpClient = map.get(hc);

        if ( httpClient == null )
        {
            httpClient = new HttpClient(new SimpleHttpConnectionManager());
            httpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                    new DefaultHttpMethodRetryHandler(RETRY_COUNT, false));
            if (log.isDebugEnabled()) {
                log.debug("Created new HttpClient: @"+System.identityHashCode(httpClient));
            }
View Full Code Here

        Map map = (Map) httpClients.get();
        HttpClient httpClient = (HttpClient) map.get(hc);

        if ( httpClient == null )
        {
            httpClient = new HttpClient(new SimpleHttpConnectionManager());
            if (log.isDebugEnabled()) {
                log.debug("Created new HttpClient: @"+System.identityHashCode(httpClient));
            }
            httpClient.setHostConfiguration(hc);
            map.put(hc, httpClient);
View Full Code Here

                multithreaded = localThreadSceme;
                if (multithreaded) {
                    manager = new MultiThreadedHttpConnectionManager();
                } else {
                    manager = new SimpleHttpConnectionManager();
                }

                XMLConfiguration config = null;

                try {
View Full Code Here

        // N.B. HostConfiguration.equals() includes proxy settings in the compare.
        HttpClient httpClient = map.get(hc);

        if ( httpClient == null )
        {
            httpClient = new HttpClient(new SimpleHttpConnectionManager());
            httpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                    new DefaultHttpMethodRetryHandler(RETRY_COUNT, false));
            if (log.isDebugEnabled()) {
                log.debug("Created new HttpClient: @"+System.identityHashCode(httpClient));
            }
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

  public static HttpClient getClient() {

    int connectionTimeout = 3000;
    int pageTimeout = 7000;
    HttpConnectionManager connectionManager = new SimpleHttpConnectionManager();
    HttpConnectionManagerParams connectionParams = connectionManager.getParams();
    connectionParams.setConnectionTimeout( connectionTimeout );
    connectionParams.setSoTimeout( pageTimeout );

    HttpClient httpClient = null;
    if ( connectionManager != null ) {
View Full Code Here

        Map map = (Map) httpClients.get();
    HttpClient httpClient = (HttpClient) map.get(hc);
   
    if ( httpClient == null )
    {
      httpClient = new HttpClient(new SimpleHttpConnectionManager());
      httpClient.setHostConfiguration(hc);
      map.put(hc, httpClient);
            // These items don't change, so only need to be done once
            if (useProxy) {
                if (PROXY_USER.length() > 0){
View Full Code Here

        StringBuffer sb = new StringBuffer(8192);
        while (m.find()) {
            m.appendReplacement(sb, now + "-" + c++);
        }
        m.appendTail(sb);
        SimpleHttpConnectionManager mgr = new SimpleHttpConnectionManager();
        try {
            mgr.getParams().setConnectionTimeout(60000);
            mgr.getParams().setSoTimeout(60000);
            HttpClient httpClient = new HttpClient(mgr);
            PostMethod httpPostMethod = new PostMethod(u.toExternalForm());
            if (proxyServer != null && proxyServer.length() > 0) {
                httpClient.getState().setCredentials(new AuthScope(proxyServer, proxyPort),
                        new UsernamePasswordCredentials(username, password));
                httpPostMethod.setDoAuthentication(true);
            }
            if (soapAction == null) soapAction = "";
            httpPostMethod.setRequestHeader("SOAPAction", "\"" + soapAction + "\"");
            httpPostMethod.setRequestHeader("Content-Type", "text/xml");
            httpPostMethod.setRequestEntity(new StringRequestEntity(sb.toString()));
            httpClient.executeMethod(httpPostMethod);
            return httpPostMethod.getResponseBodyAsString() + "\n";
        } finally {
            mgr.shutdown();
        }  
    }
View Full Code Here

TOP

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

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.