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.protocol.HttpContext;
import org.apache.http.protocol.SyncHttpExecutionContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.client.HttpClient;
@ -68,6 +69,9 @@ public abstract class AbstractHttpClient
/** The connection manager. */
protected ClientConnectionManager connManager;
/** The HTTP processor, if defined. */
protected BasicHttpProcessor httpProcessor;
/**
* Creates a new HTTP client.
@ -76,9 +80,11 @@ public abstract class AbstractHttpClient
* {@link SyncHttpExecutionContext SyncHttpExecutionContext}
* @param params the parameters
* @param conman the connection manager
* @param hproc the HTTP processor, or <code>null</code>
*/
protected AbstractHttpClient(HttpContext context, HttpParams params,
ClientConnectionManager conman) {
ClientConnectionManager conman,
BasicHttpProcessor hproc) {
if (params == null)
throw new IllegalArgumentException
("Parameters must not be null.");
@ -86,10 +92,11 @@ public abstract class AbstractHttpClient
throw new IllegalArgumentException
("Connection manager must not be null.");
defaultParams = params;
connManager = conman;
defaultContext = (context != null) ?
context : new SyncHttpExecutionContext(null);
defaultParams = params;
connManager = conman;
httpProcessor = hproc;
} // constructor
@ -143,6 +150,26 @@ public abstract class AbstractHttpClient
// 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
public final HttpResponse execute(HttpRequest request)
throws HttpException, IOException {