AbstractHttpClient += BasicHttpProcessor

git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@500559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2007-01-27 16:28:12 +00:00
parent cf5f12ea44
commit d8a3a0b5f4
1 changed files with 30 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import org.apache.http.HttpException;
import org.apache.http.params.HttpParams; import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.SyncHttpExecutionContext; import org.apache.http.protocol.SyncHttpExecutionContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
@ -68,6 +69,9 @@ public abstract class AbstractHttpClient
/** The connection manager. */ /** The connection manager. */
protected ClientConnectionManager connManager; protected ClientConnectionManager connManager;
/** The HTTP processor, if defined. */
protected BasicHttpProcessor httpProcessor;
/** /**
* Creates a new HTTP client. * Creates a new HTTP client.
@ -76,9 +80,11 @@ public abstract class AbstractHttpClient
* {@link SyncHttpExecutionContext SyncHttpExecutionContext} * {@link SyncHttpExecutionContext SyncHttpExecutionContext}
* @param params the parameters * @param params the parameters
* @param conman the connection manager * @param conman the connection manager
* @param hproc the HTTP processor, or <code>null</code>
*/ */
protected AbstractHttpClient(HttpContext context, HttpParams params, protected AbstractHttpClient(HttpContext context, HttpParams params,
ClientConnectionManager conman) { ClientConnectionManager conman,
BasicHttpProcessor hproc) {
if (params == null) if (params == null)
throw new IllegalArgumentException throw new IllegalArgumentException
("Parameters must not be null."); ("Parameters must not be null.");
@ -86,10 +92,11 @@ public abstract class AbstractHttpClient
throw new IllegalArgumentException throw new IllegalArgumentException
("Connection manager must not be null."); ("Connection manager must not be null.");
defaultParams = params;
connManager = conman;
defaultContext = (context != null) ? defaultContext = (context != null) ?
context : new SyncHttpExecutionContext(null); context : new SyncHttpExecutionContext(null);
defaultParams = params;
connManager = conman;
httpProcessor = hproc;
} // constructor } // constructor
@ -143,6 +150,26 @@ public abstract class AbstractHttpClient
// derived classes may offer that method at their own risk // derived classes may offer that method at their own risk
/**
* Obtains the HTTP processor.
*
* @return the HTTP processor, or <code>null</code> if not set
*/
public BasicHttpProcessor getProcessor() {
return httpProcessor;
}
/**
* Specifies the HTTP processor.
*
* @param hproc the HTTP processor, or <code>null</code> to unset
*/
public void setProcessor(BasicHttpProcessor hproc) {
httpProcessor = hproc;
}
// non-javadoc, see interface HttpClient // non-javadoc, see interface HttpClient
public final HttpResponse execute(HttpRequest request) public final HttpResponse execute(HttpRequest request)
throws HttpException, IOException { throws HttpException, IOException {