com.limegroup.gnutella.http
Class HttpClientManager

java.lang.Object
  extended by com.limegroup.gnutella.http.HttpClientManager

public class HttpClientManager
extends java.lang.Object

A simple manager class that maintains a single HttpConnectionManager and doles out either a simple one (for Java 1.1.8) or the MultiThreaded one (for all other versions)


Constructor Summary
HttpClientManager()
           
 
Method Summary
static void executeMethodRedirecting(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.HttpMethod methid)
          Executes the given HttpMethod in the HttpClient, following redirects.
static void executeMethodRedirecting(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.HttpMethod methid, int redirects)
          Executes the given HttpMethod in the HttpClient, following redirecits up to the specific number of times.
static org.apache.commons.httpclient.HttpClient getNewClient()
          Returns a new HttpClient with the appropriate manager.
static org.apache.commons.httpclient.HttpClient getNewClient(int connectTimeout, int soTimeout)
          Returns a new HttpClient with the appropriate manager and parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientManager

public HttpClientManager()
Method Detail

getNewClient

public static org.apache.commons.httpclient.HttpClient getNewClient()
Returns a new HttpClient with the appropriate manager.


getNewClient

public static org.apache.commons.httpclient.HttpClient getNewClient(int connectTimeout,
                                                                    int soTimeout)
Returns a new HttpClient with the appropriate manager and parameters.

Parameters:
connectTimeout - the number of milliseconds to wait to establish a TCP connection with the remote host
soTimeout - the socket timeout -- the number of milliseconds to wait for data before closing an established socket

executeMethodRedirecting

public static void executeMethodRedirecting(org.apache.commons.httpclient.HttpClient client,
                                            org.apache.commons.httpclient.HttpMethod methid)
                                     throws java.io.IOException,
                                            org.apache.commons.httpclient.HttpException
Executes the given HttpMethod in the HttpClient, following redirects. This method is needed because HttpClient does not support redirects across protocols, hosts, and/or ports.

Throws:
java.io.IOException
org.apache.commons.httpclient.HttpException

executeMethodRedirecting

public static void executeMethodRedirecting(org.apache.commons.httpclient.HttpClient client,
                                            org.apache.commons.httpclient.HttpMethod methid,
                                            int redirects)
                                     throws java.io.IOException,
                                            org.apache.commons.httpclient.HttpException
Executes the given HttpMethod in the HttpClient, following redirecits up to the specific number of times. This method is needed because HttpClient does not support redirects across protocols, hosts, and/or ports.

Throws:
java.io.IOException
org.apache.commons.httpclient.HttpException