You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/02/02 19:43:52 UTC
svn commit: r1781463 [2/2] - in /httpcomponents/httpcore/trunk:
httpcore5-ab/src/main/java/org/apache/hc/core5/http/benchmark/
httpcore5-ab/src/test/java/org/apache/hc/core5/http/benchmark/
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/ ht...
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java (from r1781462, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ConnSupport.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ConnSupport.java&r1=1781462&r2=1781463&rev=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ConnSupport.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java Thu Feb 2 19:43:52 2017
@@ -24,6 +24,7 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.hc.core5.http.impl;
import java.nio.charset.Charset;
@@ -31,20 +32,14 @@ import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
-/**
- * Connection support methods.
- *
- * @since 4.3
- */
-public final class ConnSupport {
+public final class CharCodingSupport {
- private ConnSupport() {
- // Do not allow utility class to be instantiated.
+ private CharCodingSupport() {
}
- public static CharsetDecoder createDecoder(final ConnectionConfig cconfig) {
+ public static CharsetDecoder createDecoder(final CharCodingConfig cconfig) {
if (cconfig == null) {
return null;
}
@@ -59,7 +54,7 @@ public final class ConnSupport {
return null;
}
- public static CharsetEncoder createEncoder(final ConnectionConfig cconfig) {
+ public static CharsetEncoder createEncoder(final CharCodingConfig cconfig) {
if (cconfig == null) {
return null;
}
@@ -68,8 +63,8 @@ public final class ConnSupport {
final CodingErrorAction malformed = cconfig.getMalformedInputAction();
final CodingErrorAction unmappable = cconfig.getUnmappableInputAction();
return charset.newEncoder()
- .onMalformedInput(malformed != null ? malformed : CodingErrorAction.REPORT)
- .onUnmappableCharacter(unmappable != null ? unmappable: CodingErrorAction.REPORT);
+ .onMalformedInput(malformed != null ? malformed : CodingErrorAction.REPORT)
+ .onUnmappableCharacter(unmappable != null ? unmappable: CodingErrorAction.REPORT);
}
return null;
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/CharCodingSupport.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java Thu Feb 2 19:43:52 2017
@@ -60,27 +60,27 @@ import org.apache.hc.core5.util.Args;
class BHttpConnectionBase implements BHttpConnection {
+ final H1Config h1Config;
final SessionInputBufferImpl inbuffer;
final SessionOutputBufferImpl outbuffer;
- final H1Config h1Config;
final BasicHttpConnectionMetrics connMetrics;
final AtomicReference<SocketHolder> socketHolderRef;
volatile ProtocolVersion version;
BHttpConnectionBase(
- final int buffersize,
+ final H1Config h1Config,
final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
- final H1Config h1Config) {
- Args.positive(buffersize, "Buffer size");
+ final CharsetEncoder charencoder) {
+ this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
final BasicHttpTransportMetrics inTransportMetrics = new BasicHttpTransportMetrics();
final BasicHttpTransportMetrics outTransportMetrics = new BasicHttpTransportMetrics();
- this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
- (h1Config != null ? h1Config : H1Config.DEFAULT).getMaxLineLength(), chardecoder);
- this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize,
- (h1Config != null ? h1Config : H1Config.DEFAULT).getChunkSizeHint(), charencoder);
- this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
+ this.inbuffer = new SessionInputBufferImpl(inTransportMetrics,
+ this.h1Config.getBufferSize(), -1,
+ this.h1Config.getMaxLineLength(), chardecoder);
+ this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics,
+ this.h1Config.getBufferSize(),
+ this.h1Config.getChunkSizeHint(), charencoder);
this.connMetrics = new BasicHttpConnectionMetrics(inTransportMetrics, outTransportMetrics);
this.socketHolderRef = new AtomicReference<>();
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java Thu Feb 2 19:43:52 2017
@@ -69,13 +69,12 @@ public class DefaultBHttpClientConnectio
/**
* Creates new instance of DefaultBHttpClientConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param h1Config Message h1Config. If {@code null}
+ * {@link H1Config#DEFAULT} will be used.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
* @param charencoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
- * @param h1Config Message h1Config. If {@code null}
- * {@link H1Config#DEFAULT} will be used.
* @param incomingContentStrategy incoming content length strategy. If {@code null}
* {@link DefaultContentLengthStrategy#INSTANCE} will be used.
* @param outgoingContentStrategy outgoing content length strategy. If {@code null}
@@ -86,15 +85,14 @@ public class DefaultBHttpClientConnectio
* {@link DefaultHttpResponseParserFactory#INSTANCE} will be used.
*/
public DefaultBHttpClientConnection(
- final int buffersize,
+ final H1Config h1Config,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
- final H1Config h1Config,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) {
- super(buffersize, chardecoder, charencoder, h1Config);
+ super(h1Config, chardecoder, charencoder);
this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE).create();
this.responseParser = (responseParserFactory != null ? responseParserFactory :
@@ -107,15 +105,14 @@ public class DefaultBHttpClientConnectio
}
public DefaultBHttpClientConnection(
- final int buffersize,
+ final H1Config h1Config,
final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
- final H1Config h1Config) {
- this(buffersize, chardecoder, charencoder, h1Config, null, null, null, null);
+ final CharsetEncoder charencoder) {
+ this(h1Config, chardecoder, charencoder, null, null, null, null);
}
- public DefaultBHttpClientConnection(final int buffersize) {
- this(buffersize, null, null, null, null, null, null, null);
+ public DefaultBHttpClientConnection(final H1Config h1Config) {
+ this(h1Config, null, null);
}
protected void onResponseReceived(final ClassicHttpResponse response) {
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnectionFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnectionFactory.java Thu Feb 2 19:43:52 2017
@@ -35,9 +35,9 @@ import org.apache.hc.core5.annotation.Th
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentLengthStrategy;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
+import org.apache.hc.core5.http.impl.CharCodingSupport;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.impl.ConnSupport;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
@@ -54,7 +54,7 @@ public class DefaultBHttpClientConnectio
public static final DefaultBHttpClientConnectionFactory INSTANCE = new DefaultBHttpClientConnectionFactory();
private final H1Config h1Config;
- private final ConnectionConfig cconfig;
+ private final CharCodingConfig charCodingConfig;
private final ContentLengthStrategy incomingContentStrategy;
private final ContentLengthStrategy outgoingContentStrategy;
private final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory;
@@ -62,14 +62,14 @@ public class DefaultBHttpClientConnectio
public DefaultBHttpClientConnectionFactory(
final H1Config h1Config,
- final ConnectionConfig cconfig,
+ final CharCodingConfig charCodingConfig,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) {
super();
this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
- this.cconfig = cconfig != null ? cconfig : ConnectionConfig.DEFAULT;
+ this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.incomingContentStrategy = incomingContentStrategy;
this.outgoingContentStrategy = outgoingContentStrategy;
this.requestWriterFactory = requestWriterFactory;
@@ -78,13 +78,13 @@ public class DefaultBHttpClientConnectio
public DefaultBHttpClientConnectionFactory(
final H1Config h1Config,
- final ConnectionConfig cconfig,
+ final CharCodingConfig cconfig,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) {
this(h1Config, cconfig, null, null, requestWriterFactory, responseParserFactory);
}
- public DefaultBHttpClientConnectionFactory(final ConnectionConfig cconfig) {
+ public DefaultBHttpClientConnectionFactory(final CharCodingConfig cconfig) {
this(null, cconfig, null, null, null, null);
}
@@ -95,10 +95,9 @@ public class DefaultBHttpClientConnectio
@Override
public DefaultBHttpClientConnection createConnection(final Socket socket) throws IOException {
final DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(
- this.cconfig.getBufferSize(),
- ConnSupport.createDecoder(this.cconfig),
- ConnSupport.createEncoder(this.cconfig),
this.h1Config,
+ CharCodingSupport.createDecoder(this.charCodingConfig),
+ CharCodingSupport.createEncoder(this.charCodingConfig),
this.incomingContentStrategy,
this.outgoingContentStrategy,
this.requestWriterFactory,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java Thu Feb 2 19:43:52 2017
@@ -66,13 +66,12 @@ public class DefaultBHttpServerConnectio
/**
* Creates new instance of DefaultBHttpServerConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param h1Config Message h1Config. If {@code null}
+ * {@link H1Config#DEFAULT} will be used.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
* @param charencoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
- * @param h1Config Message h1Config. If {@code null}
- * {@link H1Config#DEFAULT} will be used.
* @param incomingContentStrategy incoming content length strategy. If {@code null}
* {@link DefaultContentLengthStrategy#INSTANCE} will be used.
* @param outgoingContentStrategy outgoing content length strategy. If {@code null}
@@ -83,15 +82,14 @@ public class DefaultBHttpServerConnectio
* {@link DefaultHttpResponseWriterFactory#INSTANCE} will be used.
*/
public DefaultBHttpServerConnection(
- final int buffersize,
+ final H1Config h1Config,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
- final H1Config h1Config,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory,
final HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory) {
- super(buffersize, chardecoder, charencoder, h1Config);
+ super(h1Config, chardecoder, charencoder);
this.requestParser = (requestParserFactory != null ? requestParserFactory :
DefaultHttpRequestParserFactory.INSTANCE).create(h1Config);
this.responseWriter = (responseWriterFactory != null ? responseWriterFactory :
@@ -103,15 +101,14 @@ public class DefaultBHttpServerConnectio
}
public DefaultBHttpServerConnection(
- final int buffersize,
+ final H1Config h1Config,
final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
- final H1Config h1Config) {
- this(buffersize, chardecoder, charencoder, h1Config, null, null, null, null);
+ final CharsetEncoder charencoder) {
+ this(h1Config, chardecoder, charencoder, null, null, null, null);
}
- public DefaultBHttpServerConnection(final int buffersize) {
- this(buffersize,null, null, null, null, null, null, null);
+ public DefaultBHttpServerConnection(final H1Config h1Config) {
+ this(h1Config, null, null);
}
protected void onRequestReceived(final ClassicHttpRequest request) {
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnectionFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnectionFactory.java Thu Feb 2 19:43:52 2017
@@ -35,9 +35,9 @@ import org.apache.hc.core5.annotation.Th
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentLengthStrategy;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
+import org.apache.hc.core5.http.impl.CharCodingSupport;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.impl.ConnSupport;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
@@ -54,7 +54,7 @@ public class DefaultBHttpServerConnectio
public static final DefaultBHttpServerConnectionFactory INSTANCE = new DefaultBHttpServerConnectionFactory();
private final H1Config h1Config;
- private final ConnectionConfig cconfig;
+ private final CharCodingConfig charCodingConfig;
private final ContentLengthStrategy incomingContentStrategy;
private final ContentLengthStrategy outgoingContentStrategy;
private final HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory;
@@ -62,14 +62,14 @@ public class DefaultBHttpServerConnectio
public DefaultBHttpServerConnectionFactory(
final H1Config h1Config,
- final ConnectionConfig cconfig,
+ final CharCodingConfig charCodingConfig,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory,
final HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory) {
super();
this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
- this.cconfig = cconfig != null ? cconfig : ConnectionConfig.DEFAULT;
+ this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.incomingContentStrategy = incomingContentStrategy;
this.outgoingContentStrategy = outgoingContentStrategy;
this.requestParserFactory = requestParserFactory;
@@ -78,14 +78,14 @@ public class DefaultBHttpServerConnectio
public DefaultBHttpServerConnectionFactory(
final H1Config h1Config,
- final ConnectionConfig cconfig,
+ final CharCodingConfig charCodingConfig,
final HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory,
final HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory) {
- this(h1Config, cconfig, null, null, requestParserFactory, responseWriterFactory);
+ this(h1Config, charCodingConfig, null, null, requestParserFactory, responseWriterFactory);
}
- public DefaultBHttpServerConnectionFactory(final ConnectionConfig cconfig) {
- this(null, cconfig, null, null, null, null);
+ public DefaultBHttpServerConnectionFactory(final CharCodingConfig charCodingConfig) {
+ this(null, charCodingConfig, null, null, null, null);
}
public DefaultBHttpServerConnectionFactory() {
@@ -95,10 +95,9 @@ public class DefaultBHttpServerConnectio
@Override
public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException {
final DefaultBHttpServerConnection conn = new DefaultBHttpServerConnection(
- this.cconfig.getBufferSize(),
- ConnSupport.createDecoder(this.cconfig),
- ConnSupport.createEncoder(this.cconfig),
- h1Config,
+ this.h1Config,
+ CharCodingSupport.createDecoder(this.charCodingConfig),
+ CharCodingSupport.createEncoder(this.charCodingConfig),
this.incomingContentStrategy,
this.outgoingContentStrategy,
this.requestParserFactory,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/bootstrap/ServerBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/bootstrap/ServerBootstrap.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/bootstrap/ServerBootstrap.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/bootstrap/ServerBootstrap.java Thu Feb 2 19:43:52 2017
@@ -37,7 +37,7 @@ import org.apache.hc.core5.http.ClassicH
import org.apache.hc.core5.http.ConnectionReuseStrategy;
import org.apache.hc.core5.http.ExceptionListener;
import org.apache.hc.core5.http.HttpResponseFactory;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.Http1StreamListener;
@@ -61,7 +61,7 @@ public class ServerBootstrap {
private int listenerPort;
private InetAddress localAddress;
private SocketConfig socketConfig;
- private ConnectionConfig connectionConfig;
+ private CharCodingConfig charCodingConfig;
private HttpProcessor httpProcessor;
private ConnectionReuseStrategy connStrategy;
private HttpResponseFactory<ClassicHttpResponse> responseFactory;
@@ -112,8 +112,8 @@ public class ServerBootstrap {
* Please note this value can be overridden by the {@link #setConnectionFactory(
*HttpConnectionFactory)} method.
*/
- public final ServerBootstrap setConnectionConfig(final ConnectionConfig connectionConfig) {
- this.connectionConfig = connectionConfig;
+ public final ServerBootstrap setCharCodingConfig(final CharCodingConfig charCodingConfig) {
+ this.charCodingConfig = charCodingConfig;
return this;
}
@@ -273,8 +273,8 @@ public class ServerBootstrap {
HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactoryCopy = this.connectionFactory;
if (connectionFactoryCopy == null) {
- if (this.connectionConfig != null) {
- connectionFactoryCopy = new DefaultBHttpServerConnectionFactory(this.connectionConfig);
+ if (this.charCodingConfig != null) {
+ connectionFactoryCopy = new DefaultBHttpServerConnectionFactory(this.charCodingConfig);
} else {
connectionFactoryCopy = DefaultBHttpServerConnectionFactory.INSTANCE;
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java Thu Feb 2 19:43:52 2017
@@ -50,12 +50,12 @@ import org.apache.hc.core5.http.HttpExce
import org.apache.hc.core5.http.HttpMessage;
import org.apache.hc.core5.http.Message;
import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
+import org.apache.hc.core5.http.impl.CharCodingSupport;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicEndpointDetails;
import org.apache.hc.core5.http.impl.BasicHttpConnectionMetrics;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
-import org.apache.hc.core5.http.impl.ConnSupport;
import org.apache.hc.core5.http.impl.ConnectionListener;
import org.apache.hc.core5.http.nio.ContentDecoder;
import org.apache.hc.core5.http.nio.ContentEncoder;
@@ -84,6 +84,7 @@ abstract class AbstractHttp1StreamDuplex
private enum ConnectionState { READY, ACTIVE, GRACEFUL_SHUTDOWN, SHUTDOWN}
private final IOSession ioSession;
+ private final H1Config h1Config;
private final SessionInputBufferImpl inbuf;
private final SessionOutputBufferImpl outbuf;
private final BasicHttpTransportMetrics inTransportMetrics;
@@ -104,17 +105,18 @@ abstract class AbstractHttp1StreamDuplex
AbstractHttp1StreamDuplexer(
final IOSession ioSession,
final H1Config h1Config,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final NHttpMessageParser<IncomingMessage> incomingMessageParser,
final NHttpMessageWriter<OutgoingMessage> outgoingMessageWriter,
final ConnectionListener connectionListener) {
this.ioSession = Args.notNull(ioSession, "I/O session");
- final int bufferSize = connectionConfig.getBufferSize();
+ this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
+ final int bufferSize = this.h1Config.getBufferSize();
this.inbuf = new SessionInputBufferImpl(bufferSize, bufferSize < 512 ? bufferSize : 512,
- (h1Config != null ? h1Config : H1Config.DEFAULT).getMaxLineLength(),
- ConnSupport.createDecoder(connectionConfig));
+ this.h1Config.getMaxLineLength(),
+ CharCodingSupport.createDecoder(charCodingConfig));
this.outbuf = new SessionOutputBufferImpl(bufferSize, bufferSize < 512 ? bufferSize : 512,
- ConnSupport.createEncoder(connectionConfig));
+ CharCodingSupport.createEncoder(charCodingConfig));
this.inTransportMetrics = new BasicHttpTransportMetrics();
this.outTransportMetrics = new BasicHttpTransportMetrics();
this.connMetrics = new BasicHttpConnectionMetrics(inTransportMetrics, outTransportMetrics);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1IOEventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1IOEventHandlerFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1IOEventHandlerFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1IOEventHandlerFactory.java Thu Feb 2 19:43:52 2017
@@ -33,7 +33,7 @@ import org.apache.hc.core5.http.Connecti
import org.apache.hc.core5.http.ContentLengthStrategy;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.ConnectionListener;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
@@ -54,7 +54,7 @@ import org.apache.hc.core5.util.Args;
public class ClientHttp1IOEventHandlerFactory implements IOEventHandlerFactory {
private final HttpProcessor httpProcessor;
- private final ConnectionConfig connectionConfig;
+ private final CharCodingConfig charCodingConfig;
private final ConnectionReuseStrategy connectionReuseStrategy;
private final NHttpMessageParserFactory<HttpResponse> responseParserFactory;
private final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory;
@@ -65,7 +65,7 @@ public class ClientHttp1IOEventHandlerFa
public ClientHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
@@ -74,7 +74,7 @@ public class ClientHttp1IOEventHandlerFa
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
- this.connectionConfig = connectionConfig != null ? connectionConfig : ConnectionConfig.DEFAULT;
+ this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.connectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy :
DefaultConnectionReuseStrategy.INSTANCE;
this.responseParserFactory = responseParserFactory != null ? responseParserFactory :
@@ -91,28 +91,28 @@ public class ClientHttp1IOEventHandlerFa
public ClientHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- this(httpProcessor, connectionConfig, connectionReuseStrategy,
+ this(httpProcessor, charCodingConfig, connectionReuseStrategy,
responseParserFactory, requestWriterFactory, null ,null, connectionListener, streamListener);
}
public ClientHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- this(httpProcessor, connectionConfig, null, null, null, connectionListener, streamListener);
+ this(httpProcessor, charCodingConfig, null, null, null, connectionListener, streamListener);
}
public ClientHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
- final ConnectionConfig connectionConfig) {
- this(httpProcessor, connectionConfig, null, null);
+ final CharCodingConfig charCodingConfig) {
+ this(httpProcessor, charCodingConfig, null, null);
}
@Override
@@ -125,9 +125,9 @@ public class ClientHttp1IOEventHandlerFa
ioSession,
httpProcessor,
H1Config.DEFAULT,
- connectionConfig,
+ charCodingConfig,
connectionReuseStrategy,
- responseParserFactory.create(H1Config.DEFAULT),
+ responseParserFactory.create(),
requestWriterFactory.create(),
incomingContentStrategy,
outgoingContentStrategy,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java Thu Feb 2 19:43:52 2017
@@ -44,7 +44,7 @@ import org.apache.hc.core5.http.HttpRequ
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.LengthRequiredException;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpConnectionMetrics;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
@@ -87,7 +87,7 @@ public class ClientHttp1StreamDuplexer e
final IOSession ioSession,
final HttpProcessor httpProcessor,
final H1Config h1Config,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParser<HttpResponse> incomingMessageParser,
final NHttpMessageWriter<HttpRequest> outgoingMessageWriter,
@@ -95,7 +95,7 @@ public class ClientHttp1StreamDuplexer e
final ContentLengthStrategy outgoingContentStrategy,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- super(ioSession, h1Config, connectionConfig, incomingMessageParser, outgoingMessageWriter, connectionListener);
+ super(ioSession, h1Config, charCodingConfig, incomingMessageParser, outgoingMessageWriter, connectionListener);
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
this.connectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy :
@@ -105,7 +105,7 @@ public class ClientHttp1StreamDuplexer e
this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
DefaultContentLengthStrategy.INSTANCE;
this.streamListener = streamListener;
- this.contentBuffer = ByteBuffer.allocate((connectionConfig != null ? connectionConfig : ConnectionConfig.DEFAULT).getBufferSize());
+ this.contentBuffer = ByteBuffer.allocate(this.h1Config.getBufferSize());
this.pipeline = new ConcurrentLinkedQueue<>();
this.outputChannel = new Http1StreamChannel<HttpRequest>() {
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestParserFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestParserFactory.java Thu Feb 2 19:43:52 2017
@@ -47,17 +47,22 @@ public class DefaultHttpRequestParserFac
public static final DefaultHttpRequestParserFactory INSTANCE = new DefaultHttpRequestParserFactory();
+ private final H1Config h1Config;
private final LineParser lineParser;
private final HttpRequestFactory<HttpRequest> requestFactory;
- public DefaultHttpRequestParserFactory(final HttpRequestFactory<HttpRequest> requestFactory, final LineParser lineParser) {
+ public DefaultHttpRequestParserFactory(
+ final H1Config h1Config,
+ final HttpRequestFactory<HttpRequest> requestFactory,
+ final LineParser lineParser) {
super();
+ this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
this.requestFactory = requestFactory != null ? requestFactory : DefaultHttpRequestFactory.INSTANCE;
this.lineParser = lineParser != null ? lineParser : LazyLineParser.INSTANCE;
}
- public DefaultHttpRequestParserFactory(final HttpRequestFactory<HttpRequest> requestFactory) {
- this(requestFactory, null);
+ public DefaultHttpRequestParserFactory(final H1Config h1Config) {
+ this(h1Config, null, null);
}
public DefaultHttpRequestParserFactory() {
@@ -65,7 +70,7 @@ public class DefaultHttpRequestParserFac
}
@Override
- public NHttpMessageParser<HttpRequest> create(final H1Config h1Config) {
+ public NHttpMessageParser<HttpRequest> create() {
return new DefaultHttpRequestParser<>(requestFactory, lineParser, h1Config);
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParserFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParserFactory.java Thu Feb 2 19:43:52 2017
@@ -47,17 +47,22 @@ public class DefaultHttpResponseParserFa
public static final DefaultHttpResponseParserFactory INSTANCE = new DefaultHttpResponseParserFactory();
+ private final H1Config h1Config;
private final HttpResponseFactory<HttpResponse> responseFactory;
private final LineParser lineParser;
- public DefaultHttpResponseParserFactory(final HttpResponseFactory<HttpResponse> responseFactory, final LineParser lineParser) {
+ public DefaultHttpResponseParserFactory(
+ final H1Config h1Config,
+ final HttpResponseFactory<HttpResponse> responseFactory,
+ final LineParser lineParser) {
super();
+ this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactory.INSTANCE;
this.lineParser = lineParser != null ? lineParser : LazyLaxLineParser.INSTANCE;
}
- public DefaultHttpResponseParserFactory(final HttpResponseFactory<HttpResponse> responseFactory) {
- this(responseFactory, null);
+ public DefaultHttpResponseParserFactory(final H1Config h1Config) {
+ this(h1Config, null, null);
}
public DefaultHttpResponseParserFactory() {
@@ -65,8 +70,8 @@ public class DefaultHttpResponseParserFa
}
@Override
- public NHttpMessageParser<HttpResponse> create(final H1Config h1Config) {
- return new DefaultHttpResponseParser<>(this.responseFactory, this.lineParser, h1Config);
+ public NHttpMessageParser<HttpResponse> create() {
+ return new DefaultHttpResponseParser<>(responseFactory, lineParser, h1Config);
}
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java Thu Feb 2 19:43:52 2017
@@ -34,7 +34,7 @@ import org.apache.hc.core5.http.ContentL
import org.apache.hc.core5.http.ExceptionListener;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.ConnectionListener;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
@@ -61,7 +61,7 @@ public class ServerHttp1IOEventHandlerFa
private final HttpProcessor httpProcessor;
private final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory;
private final ConnectionReuseStrategy connectionReuseStrategy;
- private final ConnectionConfig connectionConfig;
+ private final CharCodingConfig charCodingConfig;
private final NHttpMessageParserFactory<HttpRequest> requestParserFactory;
private final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory;
private final ContentLengthStrategy incomingContentStrategy;
@@ -73,7 +73,7 @@ public class ServerHttp1IOEventHandlerFa
public ServerHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
@@ -84,7 +84,7 @@ public class ServerHttp1IOEventHandlerFa
final Http1StreamListener streamListener) {
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
this.exchangeHandlerFactory = Args.notNull(exchangeHandlerFactory, "Exchange handler factory");
- this.connectionConfig = connectionConfig != null ? connectionConfig : ConnectionConfig.DEFAULT;
+ this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.connectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy :
DefaultConnectionReuseStrategy.INSTANCE;
this.requestParserFactory = requestParserFactory != null ? requestParserFactory :
@@ -103,14 +103,14 @@ public class ServerHttp1IOEventHandlerFa
public ServerHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
final TlsStrategy tlsStrategy,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- this(httpProcessor, exchangeHandlerFactory, connectionConfig,
+ this(httpProcessor, exchangeHandlerFactory, charCodingConfig,
connectionReuseStrategy, requestParserFactory, responseWriterFactory,
null, null, tlsStrategy, connectionListener, streamListener);
}
@@ -118,21 +118,21 @@ public class ServerHttp1IOEventHandlerFa
public ServerHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final TlsStrategy tlsStrategy,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- this(httpProcessor, exchangeHandlerFactory, connectionConfig, null, null ,null,
+ this(httpProcessor, exchangeHandlerFactory, charCodingConfig, null, null ,null,
tlsStrategy, connectionListener, streamListener);
}
public ServerHttp1IOEventHandlerFactory(
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final TlsStrategy tlsStrategy,
final ExceptionListener errorListener) {
- this(httpProcessor, exchangeHandlerFactory, connectionConfig, tlsStrategy, null, null);
+ this(httpProcessor, exchangeHandlerFactory, charCodingConfig, tlsStrategy, null, null);
}
@Override
@@ -150,9 +150,9 @@ public class ServerHttp1IOEventHandlerFa
}
return new ServerHttp1StreamDuplexer(ioSession, httpProcessor, exchangeHandlerFactory,
H1Config.DEFAULT,
- connectionConfig,
+ charCodingConfig,
connectionReuseStrategy,
- requestParserFactory.create(H1Config.DEFAULT),
+ requestParserFactory.create(),
responseWriterFactory.create(),
incomingContentStrategy,
outgoingContentStrategy,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java Thu Feb 2 19:43:52 2017
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpConnectionMetrics;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
@@ -88,7 +88,7 @@ public class ServerHttp1StreamDuplexer e
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
final H1Config h1Config,
- final ConnectionConfig connectionConfig,
+ final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy,
final NHttpMessageParser<HttpRequest> incomingMessageParser,
final NHttpMessageWriter<HttpResponse> outgoingMessageWriter,
@@ -96,7 +96,7 @@ public class ServerHttp1StreamDuplexer e
final ContentLengthStrategy outgoingContentStrategy,
final ConnectionListener connectionListener,
final Http1StreamListener streamListener) {
- super(ioSession, h1Config, connectionConfig, incomingMessageParser, outgoingMessageWriter, connectionListener);
+ super(ioSession, h1Config, charCodingConfig, incomingMessageParser, outgoingMessageWriter, connectionListener);
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
this.exchangeHandlerFactory = Args.notNull(exchangeHandlerFactory, "Exchange handler factory");
this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
@@ -107,7 +107,7 @@ public class ServerHttp1StreamDuplexer e
this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
DefaultContentLengthStrategy.INSTANCE;
this.streamListener = streamListener;
- this.contentBuffer = ByteBuffer.allocate(connectionConfig.getBufferSize());
+ this.contentBuffer = ByteBuffer.allocate(this.h1Config.getBufferSize());
this.pipeline = new ConcurrentLinkedQueue<>();
this.outputChannel = new Http1StreamChannel<HttpResponse>() {
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/RequesterBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/RequesterBootstrap.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/RequesterBootstrap.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/RequesterBootstrap.java Thu Feb 2 19:43:52 2017
@@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.hc.core5.http.ConnectionReuseStrategy;
import org.apache.hc.core5.http.ExceptionListener;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.impl.ConnectionListener;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
@@ -54,7 +54,7 @@ import org.apache.hc.core5.reactor.IORea
public class RequesterBootstrap {
private IOReactorConfig ioReactorConfig;
- private ConnectionConfig connectionConfig;
+ private CharCodingConfig charCodingConfig;
private HttpProcessor httpProcessor;
private ConnectionReuseStrategy connStrategy;
private int defaultMaxPerRoute;
@@ -86,8 +86,8 @@ public class RequesterBootstrap {
/**
* Sets connection configuration.
*/
- public final RequesterBootstrap setConnectionConfig(final ConnectionConfig connectionConfig) {
- this.connectionConfig = connectionConfig;
+ public final RequesterBootstrap setCharCodingConfig(final CharCodingConfig charCodingConfig) {
+ this.charCodingConfig = charCodingConfig;
return this;
}
@@ -180,7 +180,7 @@ public class RequesterBootstrap {
connPoolListener);
final ClientHttp1IOEventHandlerFactory ioEventHandlerFactory = new ClientHttp1IOEventHandlerFactory(
httpProcessor != null ? httpProcessor : HttpProcessors.client(),
- connectionConfig,
+ charCodingConfig,
connStrategy != null ? connStrategy : DefaultConnectionReuseStrategy.INSTANCE,
DefaultHttpResponseParserFactory.INSTANCE,
DefaultHttpRequestWriterFactory.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/ServerBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/ServerBootstrap.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/ServerBootstrap.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/bootstrap/ServerBootstrap.java Thu Feb 2 19:43:52 2017
@@ -32,7 +32,7 @@ import java.util.List;
import org.apache.hc.core5.function.Supplier;
import org.apache.hc.core5.http.ConnectionReuseStrategy;
import org.apache.hc.core5.http.ExceptionListener;
-import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.impl.ConnectionListener;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
@@ -60,7 +60,7 @@ public class ServerBootstrap {
private final List<HandlerEntry> handlerList;
private String canonicalHostName;
private IOReactorConfig ioReactorConfig;
- private ConnectionConfig connectionConfig;
+ private CharCodingConfig charCodingConfig;
private HttpProcessor httpProcessor;
private ConnectionReuseStrategy connStrategy;
private TlsStrategy tlsStrategy;
@@ -97,8 +97,8 @@ public class ServerBootstrap {
/**
* Sets connection configuration.
*/
- public final ServerBootstrap setConnectionConfig(final ConnectionConfig connectionConfig) {
- this.connectionConfig = connectionConfig;
+ public final ServerBootstrap setCharCodingConfig(final CharCodingConfig charCodingConfig) {
+ this.charCodingConfig = charCodingConfig;
return this;
}
@@ -207,7 +207,7 @@ public class ServerBootstrap {
final ServerHttp1IOEventHandlerFactory ioEventHandlerFactory = new ServerHttp1IOEventHandlerFactory(
httpProcessor != null ? httpProcessor : HttpProcessors.server(),
exchangeHandlerFactory,
- connectionConfig,
+ charCodingConfig,
connStrategy != null ? connStrategy : DefaultConnectionReuseStrategy.INSTANCE,
DefaultHttpRequestParserFactory.INSTANCE,
DefaultHttpResponseWriterFactory.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java Thu Feb 2 19:43:52 2017
@@ -28,7 +28,6 @@
package org.apache.hc.core5.http.nio;
import org.apache.hc.core5.http.MessageHeaders;
-import org.apache.hc.core5.http.config.H1Config;
/**
* Factory for {@link NHttpMessageParser} instances.
@@ -37,6 +36,6 @@ import org.apache.hc.core5.http.config.H
*/
public interface NHttpMessageParserFactory<T extends MessageHeaders> {
- NHttpMessageParser<T> create(H1Config h1Config);
+ NHttpMessageParser<T> create();
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java Thu Feb 2 19:43:52 2017
@@ -57,7 +57,7 @@ public class TestBHttpConnectionBase {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new BHttpConnectionBase(1024,null, null, H1Config.DEFAULT);
+ conn = new BHttpConnectionBase(H1Config.DEFAULT, null, null);
}
@Test
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java Thu Feb 2 19:43:52 2017
@@ -60,9 +60,8 @@ public class TestDefaultBHttpClientConne
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new DefaultBHttpClientConnection(1024,
+ conn = new DefaultBHttpClientConnection(H1Config.DEFAULT,
null, null,
- H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
DefaultContentLengthStrategy.INSTANCE,
DefaultHttpRequestWriterFactory.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java?rev=1781463&r1=1781462&r2=1781463&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java Thu Feb 2 19:43:52 2017
@@ -59,9 +59,8 @@ public class TestDefaultBHttpServerConne
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new DefaultBHttpServerConnection(1024,
+ conn = new DefaultBHttpServerConnection(H1Config.DEFAULT,
null, null,
- H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
DefaultContentLengthStrategy.INSTANCE,
DefaultHttpRequestParserFactory.INSTANCE,