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
This commit is contained in:
parent
b1781b2a60
commit
60bca79a3c
|
@ -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<ManagedHttpClientConnection> 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,
|
||||
|
|
|
@ -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<HttpRequest> requestWriterFactory;
|
||||
private final HttpMessageParserFactory<HttpResponse> responseParserFactory;
|
||||
|
||||
public ManagedHttpClientConnectionFactory(
|
||||
final int bufferSize,
|
||||
final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
|
||||
final HttpMessageParserFactory<HttpResponse> 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<HttpRequest> requestWriterFactory,
|
||||
final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
|
||||
this(DEFAULT_BUFSIZE, requestWriterFactory, responseParserFactory);
|
||||
}
|
||||
|
||||
public ManagedHttpClientConnectionFactory(
|
||||
final HttpMessageParserFactory<HttpResponse> 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(),
|
||||
|
|
|
@ -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<HttpRequest> requestWriterFactory,
|
||||
final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
|
||||
super(buffersize, chardecoder, charencoder,
|
||||
super(buffersize, fragmentSizeHint, chardecoder, charencoder,
|
||||
constraints, incomingContentStrategy, outgoingContentStrategy,
|
||||
requestWriterFactory, responseParserFactory);
|
||||
this.id = id;
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -65,7 +65,7 @@
|
|||
</scm>
|
||||
|
||||
<properties>
|
||||
<httpcore.version>4.3-alpha1</httpcore.version>
|
||||
<httpcore.version>4.3-beta1</httpcore.version>
|
||||
<commons-logging.version>1.1.1</commons-logging.version>
|
||||
<commons-codec.version>1.6</commons-codec.version>
|
||||
<ehcache.version>2.2.0</ehcache.version>
|
||||
|
|
Loading…
Reference in New Issue