From 60bca79a3c8b0590ab680681a25d8fa6fe303aca Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Mon, 25 Mar 2013 15:34:27 +0000 Subject: [PATCH] Upgraded HttpCore to version 4.3-beta1 git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1460717 13f79535-47bb-0310-9956-ffa450edef68 --- .../examples/client/ClientConfiguration.java | 7 +++---- .../ManagedHttpClientConnectionFactory.java | 21 +++---------------- .../conn/ManagedHttpClientConnectionImpl.java | 3 ++- pom.xml | 2 +- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java index d05d9db1f..838c7fca5 100644 --- a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java +++ b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java @@ -128,11 +128,10 @@ public class ClientConfiguration { // Use a custom connection factory to customize the process of // initialization of outgoing HTTP connections. Beside standard connection - // configuration parameters HTTP connection factory can control the size of - // input / output buffers as well as determine message parser / writer routines - // to be employed by individual connections. + // configuration parameters HTTP connection factory can define message + // parser / writer routines to be employed by individual connections. HttpConnectionFactory connFactory = new ManagedHttpClientConnectionFactory( - 8 * 1024, requestWriterFactory, responseParserFactory); + requestWriterFactory, responseParserFactory); // Client HTTP connection objects when fully initialized can be bound to // an arbitrary network socket. The process of network socket initialization, diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java index 9b497fb6e..bb4c0ce67 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java @@ -44,7 +44,6 @@ import org.apache.http.conn.ManagedHttpClientConnection; import org.apache.http.impl.io.DefaultHttpRequestWriterFactory; import org.apache.http.io.HttpMessageParserFactory; import org.apache.http.io.HttpMessageWriterFactory; -import org.apache.http.util.Args; /** * @since 4.3 @@ -54,47 +53,32 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory private static final AtomicLong COUNTER = new AtomicLong(); - private static final int DEFAULT_BUFSIZE = 8 * 1024; - public static final ManagedHttpClientConnectionFactory INSTANCE = new ManagedHttpClientConnectionFactory(); private final Log log = LogFactory.getLog(ManagedHttpClientConnectionImpl.class); private final Log headerlog = LogFactory.getLog("org.apache.http.headers"); private final Log wirelog = LogFactory.getLog("org.apache.http.wire"); - private final int bufferSize; private final HttpMessageWriterFactory requestWriterFactory; private final HttpMessageParserFactory responseParserFactory; public ManagedHttpClientConnectionFactory( - final int bufferSize, final HttpMessageWriterFactory requestWriterFactory, final HttpMessageParserFactory responseParserFactory) { super(); - this.bufferSize = Args.notNegative(bufferSize, "Buffer size"); this.requestWriterFactory = requestWriterFactory != null ? requestWriterFactory : DefaultHttpRequestWriterFactory.INSTANCE; this.responseParserFactory = responseParserFactory != null ? responseParserFactory : DefaultHttpResponseParserFactory.INSTANCE; } - public ManagedHttpClientConnectionFactory( - final HttpMessageWriterFactory requestWriterFactory, - final HttpMessageParserFactory responseParserFactory) { - this(DEFAULT_BUFSIZE, requestWriterFactory, responseParserFactory); - } - public ManagedHttpClientConnectionFactory( final HttpMessageParserFactory responseParserFactory) { this(null, responseParserFactory); } - public ManagedHttpClientConnectionFactory(final int bufferSize) { - this(bufferSize, null, null); - } - public ManagedHttpClientConnectionFactory() { - this(DEFAULT_BUFSIZE, null, null); + this(null, null); } public ManagedHttpClientConnection create(final ConnectionConfig config) { @@ -120,7 +104,8 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory log, headerlog, wirelog, - bufferSize, + config.getBufferSize(), + config.getFragmentSizeHint(), chardecoder, charencoder, cconfig.getMessageConstraints(), diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionImpl.java b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionImpl.java index dd1852728..52ee63a04 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionImpl.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionImpl.java @@ -69,6 +69,7 @@ class ManagedHttpClientConnectionImpl extends DefaultBHttpClientConnection final Log headerlog, final Log wirelog, final int buffersize, + final int fragmentSizeHint, final CharsetDecoder chardecoder, final CharsetEncoder charencoder, final MessageConstraints constraints, @@ -76,7 +77,7 @@ class ManagedHttpClientConnectionImpl extends DefaultBHttpClientConnection final ContentLengthStrategy outgoingContentStrategy, final HttpMessageWriterFactory requestWriterFactory, final HttpMessageParserFactory responseParserFactory) { - super(buffersize, chardecoder, charencoder, + super(buffersize, fragmentSizeHint, chardecoder, charencoder, constraints, incomingContentStrategy, outgoingContentStrategy, requestWriterFactory, responseParserFactory); this.id = id; diff --git a/pom.xml b/pom.xml index 67bcd7ee5..d5429462d 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ - 4.3-alpha1 + 4.3-beta1 1.1.1 1.6 2.2.0