hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1400016 [1/2] - in /httpcomponents/httpcore/trunk: httpcore-nio/src/examples/org/apache/http/examples/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ httpcore-nio/src/ma...
Date Fri, 19 Oct 2012 09:53:29 GMT
Author: olegk
Date: Fri Oct 19 09:53:27 2012
New Revision: 1400016

URL: http://svn.apache.org/viewvc?rev=1400016&view=rev
Log:
Configuration API changes: added SocketConfig and ConnectionConfig classes

Added:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java   (with props)
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java   (contents, props changed)
      - copied, changed from r1398785, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/MessageConstraints.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java   (with props)
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamConfig.java   (with props)
Removed:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/MessageConstraints.java
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParser.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParserFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParser.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParserFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpMessageParserFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParserFactory.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParserFactory.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnFactory.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageParserFactory.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/SessionInputBufferMock.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java Fri Oct 19 09:53:27 2012
@@ -29,12 +29,12 @@ package org.apache.http.examples.nio;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
 import org.apache.http.impl.nio.pool.BasicNIOConnPool;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
@@ -71,11 +71,12 @@ public class NHttpClient {
         // Create client-side HTTP protocol handler
         HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
         // Create client-side I/O event dispatch
-        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler);
+        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler,
+                ConnectionConfig.DEFAULT);
         // Create client-side I/O reactor
         final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
         // Create HTTP connection pool
-        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, 3, TimeUnit.SECONDS);
+        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, ConnectionConfig.DEFAULT);
         // Limit total number of connections to just two
         pool.setDefaultMaxPerRoute(2);
         pool.setMaxTotal(2);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java Fri Oct 19 09:53:27 2012
@@ -45,6 +45,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.entity.ContentType;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.EnglishReasonPhraseCatalog;
@@ -151,7 +152,7 @@ public class NHttpReverseProxy {
         HttpAsyncRequester executor = new HttpAsyncRequester(
                 outhttpproc, new ProxyOutgoingConnectionReuseStrategy());
 
-        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, 3, TimeUnit.SECONDS);
+        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, ConnectionConfig.DEFAULT);
         connPool.setMaxTotal(100);
         connPool.setDefaultMaxPerRoute(20);
 
@@ -164,10 +165,10 @@ public class NHttpReverseProxy {
                 handlerRegistry);
 
         final IOEventDispatch connectingEventDispatch = new DefaultHttpClientIODispatch(
-                clientHandler);
+                clientHandler, ConnectionConfig.DEFAULT);
 
         final IOEventDispatch listeningEventDispatch = new DefaultHttpServerIODispatch(
-                serviceHandler);
+                serviceHandler, ConnectionConfig.DEFAULT);
 
         Thread t = new Thread(new Runnable() {
 
@@ -843,9 +844,10 @@ public class NHttpReverseProxy {
 
     static class ProxyConnPool extends BasicNIOConnPool {
 
-        public ProxyConnPool(final ConnectingIOReactor ioreactor,
-                int connectTimeout, final TimeUnit tunit) {
-            super(ioreactor, connectTimeout, tunit);
+        public ProxyConnPool(
+                final ConnectingIOReactor ioreactor,
+                final ConnectionConfig config) {
+            super(ioreactor, config);
         }
 
         public ProxyConnPool(

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java Fri Oct 19 09:53:27 2012
@@ -45,6 +45,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpStatus;
 import org.apache.http.MethodNotSupportedException;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.entity.ContentType;
 import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
 import org.apache.http.impl.nio.DefaultNHttpServerConnection;
@@ -139,9 +140,11 @@ public class NHttpServer {
             KeyManager[] keymanagers = kmfactory.getKeyManagers();
             SSLContext sslcontext = SSLContext.getInstance("TLS");
             sslcontext.init(keymanagers, null, null);
-            connFactory = new SSLNHttpServerConnectionFactory(sslcontext, null);
+            connFactory = new SSLNHttpServerConnectionFactory(sslcontext, 
+                    null, ConnectionConfig.DEFAULT);
         } else {
-            connFactory = new DefaultNHttpServerConnectionFactory();
+            connFactory = new DefaultNHttpServerConnectionFactory(
+                    ConnectionConfig.DEFAULT);
         }
         // Create server-side I/O event dispatch
         IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(protocolHandler, connFactory);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java Fri Oct 19 09:53:27 2012
@@ -32,6 +32,7 @@ import java.io.IOException;
 import javax.net.ssl.SSLContext;
 
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpClientEventHandler;
 import org.apache.http.nio.NHttpConnectionFactory;
@@ -108,8 +109,8 @@ public class DefaultHttpClientIODispatch
     /**
      * @since 4.3
      */
-    public DefaultHttpClientIODispatch(final NHttpClientEventHandler handler) {
-        this(handler, new DefaultNHttpClientConnectionFactory());
+    public DefaultHttpClientIODispatch(final NHttpClientEventHandler handler, final ConnectionConfig config) {
+        this(handler, new DefaultNHttpClientConnectionFactory(config));
     }
 
     /**
@@ -118,8 +119,9 @@ public class DefaultHttpClientIODispatch
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
             final SSLContext sslcontext,
-            final SSLSetupHandler sslHandler) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler));
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, config));
     }
 
     /**
@@ -127,8 +129,9 @@ public class DefaultHttpClientIODispatch
      */
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, null));
+            final SSLContext sslcontext,
+            final ConnectionConfig config) {
+        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, null, config));
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java Fri Oct 19 09:53:27 2012
@@ -32,6 +32,7 @@ import java.io.IOException;
 import javax.net.ssl.SSLContext;
 
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.NHttpServerEventHandler;
@@ -101,8 +102,8 @@ public class DefaultHttpServerIODispatch
     /**
      * @since 4.3
      */
-    public DefaultHttpServerIODispatch(final NHttpServerEventHandler handler) {
-        this(handler, new DefaultNHttpServerConnectionFactory());
+    public DefaultHttpServerIODispatch(final NHttpServerEventHandler handler, final ConnectionConfig config) {
+        this(handler, new DefaultNHttpServerConnectionFactory(config));
     }
 
     /**
@@ -111,8 +112,9 @@ public class DefaultHttpServerIODispatch
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
             final SSLContext sslcontext,
-            final SSLSetupHandler sslHandler) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler));
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, config));
     }
 
     /**
@@ -120,8 +122,9 @@ public class DefaultHttpServerIODispatch
      */
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, null));
+            final SSLContext sslcontext,
+            final ConnectionConfig config) {
+        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, null, config));
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java Fri Oct 19 09:53:27 2012
@@ -39,8 +39,8 @@ import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.impl.nio.codecs.DefaultHttpRequestWriter;
@@ -61,8 +61,7 @@ import org.apache.http.nio.reactor.Sessi
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.Config;
-import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -182,10 +181,7 @@ public class DefaultNHttpClientConnectio
             final HttpResponseFactory responseFactory,
             final HttpParams params) {
         // override in derived class to specify a line parser
-        MessageConstraints constraints = MessageConstraints.custom()
-                .setMaxLineLength(Config.getInt(params, CoreConnectionPNames.MAX_LINE_LENGTH, -1))
-                .setMaxHeaderCount(Config.getInt(params, CoreConnectionPNames.MAX_HEADER_COUNT, -1))
-                .build();
+        MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
         return new DefaultHttpResponseParser(buffer, null, responseFactory, constraints);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java Fri Oct 19 09:53:27 2012
@@ -26,9 +26,15 @@
  */
 package org.apache.http.impl.nio;
 
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpResponseParserFactory;
 import org.apache.http.nio.NHttpClientConnection;
@@ -37,8 +43,7 @@ import org.apache.http.nio.NHttpMessageP
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.Config;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -53,9 +58,8 @@ public class DefaultNHttpClientConnectio
     implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
 
     private final NHttpMessageParserFactory<HttpResponse> responseParserFactory;
-    private final HttpResponseFactory responseFactory;
     private final ByteBufferAllocator allocator;
-    private final HttpParams params;
+    private final ConnectionConfig config;
 
     /**
      * @deprecated (4.3) use {@link
@@ -71,10 +75,9 @@ public class DefaultNHttpClientConnectio
         Args.notNull(responseFactory, "HTTP response factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.responseFactory = responseFactory;
         this.allocator = allocator;
-        this.params = params;
-        this.responseParserFactory = null;
+        this.responseParserFactory = new DefaultHttpResponseParserFactory(null, responseFactory);
+        this.config = HttpParamConfig.getConnectionConfig(params);
     }
 
     /**
@@ -91,19 +94,19 @@ public class DefaultNHttpClientConnectio
      */
     public DefaultNHttpClientConnectionFactory(
             final HttpResponseFactory responseFactory,
-            final ByteBufferAllocator allocator) {
+            final ByteBufferAllocator allocator,
+            final ConnectionConfig config) {
         super();
-        this.responseFactory = responseFactory;
-        this.allocator = allocator;
+        this.allocator = allocator != null ? allocator : HeapByteBufferAllocator.INSTANCE;
         this.responseParserFactory = new DefaultHttpResponseParserFactory(null, responseFactory);
-        this.params = null;
+        this.config = config != null ? config : ConnectionConfig.DEFAULT;
     }
 
     /**
      * @since 4.3
      */
-    public DefaultNHttpClientConnectionFactory() {
-        this(null, null);
+    public DefaultNHttpClientConnectionFactory(final ConnectionConfig config) {
+        this(null, null, config);
     }
 
     /**
@@ -119,19 +122,27 @@ public class DefaultNHttpClientConnectio
     }
 
     public DefaultNHttpClientConnection createConnection(final IOSession session) {
-        if (this.params != null) {
-            DefaultNHttpClientConnection conn = createConnection(session, this.responseFactory,
-                    this.allocator, this.params);
-            int timeout = Config.getInt(this.params, CoreConnectionPNames.SO_TIMEOUT, 0);
-            conn.setSocketTimeout(timeout);
-            return conn;
-        } else {
-            return new DefaultNHttpClientConnection(
-                    session, 8 * 1024,
-                    this.allocator,
-                    null, null, null, null, null, null,
-                    this.responseParserFactory);
+        CharsetDecoder chardecoder = null;
+        CharsetEncoder charencoder = null;
+        Charset charset = this.config.getCharset();
+        CodingErrorAction malformedInputAction = this.config.getMalformedInputAction() != null ?
+                this.config.getMalformedInputAction() : CodingErrorAction.REPORT;
+        CodingErrorAction unmappableInputAction = this.config.getUnmappableInputAction() != null ?
+                this.config.getUnmappableInputAction() : CodingErrorAction.REPORT;
+        if (charset != null) {
+            chardecoder = charset.newDecoder();
+            chardecoder.onMalformedInput(malformedInputAction);
+            chardecoder.onUnmappableCharacter(unmappableInputAction);
+            charencoder = charset.newEncoder();
+            charencoder.onMalformedInput(malformedInputAction);
+            charencoder.onUnmappableCharacter(unmappableInputAction);
         }
+        return new DefaultNHttpClientConnection(
+                session, 8 * 1024,
+                this.allocator,
+                chardecoder, charencoder, this.config.getMessageConstraints(),
+                null, null, null,
+                this.responseParserFactory);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java Fri Oct 19 09:53:27 2012
@@ -39,8 +39,8 @@ import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.HttpResponse;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.impl.entity.DisallowIdentityContentLengthStrategy;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
@@ -62,8 +62,7 @@ import org.apache.http.nio.reactor.Sessi
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.Config;
-import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -193,10 +192,7 @@ public class DefaultNHttpServerConnectio
             final SessionInputBuffer buffer,
             final HttpRequestFactory requestFactory,
             final HttpParams params) {
-        MessageConstraints constraints = MessageConstraints.custom()
-                .setMaxLineLength(Config.getInt(params, CoreConnectionPNames.MAX_LINE_LENGTH, -1))
-                .setMaxHeaderCount(Config.getInt(params, CoreConnectionPNames.MAX_HEADER_COUNT, -1))
-                .build();
+        MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
         return new DefaultHttpRequestParser(buffer, null, requestFactory, constraints);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java Fri Oct 19 09:53:27 2012
@@ -26,9 +26,15 @@
  */
 package org.apache.http.impl.nio;
 
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpRequestParserFactory;
 import org.apache.http.nio.NHttpConnectionFactory;
@@ -37,8 +43,7 @@ import org.apache.http.nio.NHttpServerCo
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.Config;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -53,9 +58,8 @@ public class DefaultNHttpServerConnectio
     implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
     private final NHttpMessageParserFactory<HttpRequest> requestParserFactory;
-    private final HttpRequestFactory requestFactory;
     private final ByteBufferAllocator allocator;
-    private final HttpParams params;
+    private final ConnectionConfig config;
 
     /**
      * @deprecated (4.3) use {@link
@@ -71,10 +75,9 @@ public class DefaultNHttpServerConnectio
         Args.notNull(requestFactory, "HTTP request factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.requestFactory = requestFactory;
+        this.requestParserFactory = new DefaultHttpRequestParserFactory(null, requestFactory);
         this.allocator = allocator;
-        this.params = params;
-        this.requestParserFactory = null;
+        this.config = HttpParamConfig.getConnectionConfig(params);
     }
 
     /**
@@ -103,35 +106,43 @@ public class DefaultNHttpServerConnectio
      */
     public DefaultNHttpServerConnectionFactory(
             final ByteBufferAllocator allocator,
-            final HttpRequestFactory requestFactory) {
+            final HttpRequestFactory requestFactory,
+            final ConnectionConfig config) {
         super();
-        this.requestFactory = requestFactory;
-        this.allocator = allocator;
+        this.allocator = allocator != null ? allocator : HeapByteBufferAllocator.INSTANCE;
         this.requestParserFactory = new DefaultHttpRequestParserFactory(null, requestFactory);
-        this.params = null;
+        this.config = config != null ? config : ConnectionConfig.DEFAULT;
     }
 
     /**
      * @since 4.3
      */
-    public DefaultNHttpServerConnectionFactory() {
-        this(null, null);
+    public DefaultNHttpServerConnectionFactory(final ConnectionConfig config) {
+        this(null, null, config);
     }
 
     public DefaultNHttpServerConnection createConnection(final IOSession session) {
-        if (this.params != null) {
-            DefaultNHttpServerConnection conn = createConnection(
-                    session, this.requestFactory, this.allocator, this.params);
-            int timeout = Config.getInt(this.params, CoreConnectionPNames.SO_TIMEOUT, 0);
-            conn.setSocketTimeout(timeout);
-            return conn;
-        } else {
-            return new DefaultNHttpServerConnection(session, 8 * 1024,
-                    this.allocator,
-                    null, null, null, null, null,
-                    this.requestParserFactory,
-                    null);
+        CharsetDecoder chardecoder = null;
+        CharsetEncoder charencoder = null;
+        Charset charset = this.config.getCharset();
+        CodingErrorAction malformedInputAction = this.config.getMalformedInputAction() != null ?
+                this.config.getMalformedInputAction() : CodingErrorAction.REPORT;
+        CodingErrorAction unmappableInputAction = this.config.getUnmappableInputAction() != null ?
+                this.config.getUnmappableInputAction() : CodingErrorAction.REPORT;
+        if (charset != null) {
+            chardecoder = charset.newDecoder();
+            chardecoder.onMalformedInput(malformedInputAction);
+            chardecoder.onUnmappableCharacter(unmappableInputAction);
+            charencoder = charset.newEncoder();
+            charencoder.onMalformedInput(malformedInputAction);
+            charencoder.onUnmappableCharacter(unmappableInputAction);
         }
+        return new DefaultNHttpServerConnection(session, 8 * 1024,
+                this.allocator,
+                chardecoder, charencoder, this.config.getMessageConstraints(),
+                null, null,
+                this.requestParserFactory,
+                null);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java Fri Oct 19 09:53:27 2012
@@ -50,10 +50,10 @@ import org.apache.http.HttpMessage;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.HttpConnectionMetricsImpl;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.impl.io.HttpTransportMetricsImpl;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java Fri Oct 19 09:53:27 2012
@@ -26,14 +26,19 @@
  */
 package org.apache.http.impl.nio;
 
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+
 import javax.net.ssl.SSLContext;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpResponseParserFactory;
-import org.apache.http.message.BasicLineParser;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.NHttpMessageParserFactory;
@@ -43,8 +48,7 @@ import org.apache.http.nio.reactor.ssl.S
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.Config;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -59,11 +63,10 @@ public class SSLNHttpClientConnectionFac
     implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
 
     private final NHttpMessageParserFactory<HttpResponse> responseParserFactory;
-    private final HttpResponseFactory responseFactory;
     private final ByteBufferAllocator allocator;
     private final SSLContext sslcontext;
     private final SSLSetupHandler sslHandler;
-    private final HttpParams params;
+    private final ConnectionConfig config;
 
     /**
      * @deprecated (4.3) use {@link
@@ -83,10 +86,9 @@ public class SSLNHttpClientConnectionFac
         Args.notNull(params, "HTTP parameters");
         this.sslcontext = sslcontext;
         this.sslHandler = sslHandler;
-        this.responseFactory = responseFactory;
         this.allocator = allocator;
-        this.params = params;
-        this.responseParserFactory = null;
+        this.responseParserFactory = new DefaultHttpResponseParserFactory(null, responseFactory);
+        this.config = HttpParamConfig.getConnectionConfig(params);
     }
 
     /**
@@ -119,16 +121,14 @@ public class SSLNHttpClientConnectionFac
             final SSLContext sslcontext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
-            final ByteBufferAllocator allocator) {
+            final ByteBufferAllocator allocator,
+            final ConnectionConfig config) {
         super();
         this.sslcontext = sslcontext;
         this.sslHandler = sslHandler;
-        this.responseFactory = responseFactory;
         this.allocator = allocator != null ? allocator : HeapByteBufferAllocator.INSTANCE;
-        this.responseParserFactory = new DefaultHttpResponseParserFactory(
-                BasicLineParser.INSTANCE,
-                responseFactory != null ? responseFactory : DefaultHttpResponseFactory.INSTANCE);
-        this.params = null;
+        this.responseParserFactory = new DefaultHttpResponseParserFactory(null, responseFactory);
+        this.config = config != null ? config : ConnectionConfig.DEFAULT;
     }
 
     /**
@@ -136,15 +136,16 @@ public class SSLNHttpClientConnectionFac
      */
     public SSLNHttpClientConnectionFactory(
             final SSLContext sslcontext,
-            final SSLSetupHandler sslHandler) {
-        this(sslcontext, sslHandler, null, null);
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        this(sslcontext, sslHandler, null, null, config);
     }
 
     /**
      * @since 4.3
      */
-    public SSLNHttpClientConnectionFactory() {
-        this(null, null, null, null);
+    public SSLNHttpClientConnectionFactory(final ConnectionConfig config) {
+        this(null, null, null, null, config);
     }
 
     private SSLContext getDefaultSSLContext() {
@@ -186,19 +187,27 @@ public class SSLNHttpClientConnectionFac
 
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
         SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
-        if (this.params != null) {
-            DefaultNHttpClientConnection conn = createConnection(
-                    ssliosession, this.responseFactory, this.allocator, this.params);
-            int timeout = Config.getInt(this.params, CoreConnectionPNames.SO_TIMEOUT, 0);
-            conn.setSocketTimeout(timeout);
-            return conn;
-        } else {
-            return new DefaultNHttpClientConnection(
-                    ssliosession, 8 * 1024,
-                    this.allocator,
-                    null, null, null, null, null, null,
-                    this.responseParserFactory);
+        CharsetDecoder chardecoder = null;
+        CharsetEncoder charencoder = null;
+        Charset charset = this.config.getCharset();
+        CodingErrorAction malformedInputAction = this.config.getMalformedInputAction() != null ?
+                this.config.getMalformedInputAction() : CodingErrorAction.REPORT;
+        CodingErrorAction unmappableInputAction = this.config.getUnmappableInputAction() != null ?
+                this.config.getUnmappableInputAction() : CodingErrorAction.REPORT;
+        if (charset != null) {
+            chardecoder = charset.newDecoder();
+            chardecoder.onMalformedInput(malformedInputAction);
+            chardecoder.onUnmappableCharacter(unmappableInputAction);
+            charencoder = charset.newEncoder();
+            charencoder.onMalformedInput(malformedInputAction);
+            charencoder.onUnmappableCharacter(unmappableInputAction);
         }
+        return new DefaultNHttpClientConnection(
+                ssliosession, 8 * 1024,
+                this.allocator,
+                chardecoder, charencoder, this.config.getMessageConstraints(),
+                null, null, null,
+                this.responseParserFactory);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java Fri Oct 19 09:53:27 2012
@@ -26,11 +26,17 @@
  */
 package org.apache.http.impl.nio;
 
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+
 import javax.net.ssl.SSLContext;
 
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpRequestParserFactory;
 import org.apache.http.nio.NHttpConnectionFactory;
@@ -42,8 +48,7 @@ import org.apache.http.nio.reactor.ssl.S
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.Config;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 
@@ -58,11 +63,10 @@ public class SSLNHttpServerConnectionFac
     implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
     private final NHttpMessageParserFactory<HttpRequest> requestParserFactory;
-    private final HttpRequestFactory requestFactory;
     private final ByteBufferAllocator allocator;
     private final SSLContext sslcontext;
     private final SSLSetupHandler sslHandler;
-    private final HttpParams params;
+    private final ConnectionConfig config;
 
     /**
      * @deprecated (4.3) use {@link
@@ -82,10 +86,9 @@ public class SSLNHttpServerConnectionFac
         Args.notNull(params, "HTTP parameters");
         this.sslcontext = sslcontext;
         this.sslHandler = sslHandler;
-        this.requestFactory = requestFactory;
         this.allocator = allocator;
-        this.params = params;
-        this.requestParserFactory = null;
+        this.requestParserFactory = new DefaultHttpRequestParserFactory(null, requestFactory);
+        this.config = HttpParamConfig.getConnectionConfig(params);
     }
 
     /**
@@ -118,14 +121,14 @@ public class SSLNHttpServerConnectionFac
             final SSLContext sslcontext,
             final SSLSetupHandler sslHandler,
             final HttpRequestFactory requestFactory,
-            final ByteBufferAllocator allocator) {
+            final ByteBufferAllocator allocator,
+            final ConnectionConfig config) {
         super();
         this.sslcontext = sslcontext;
         this.sslHandler = sslHandler;
-        this.requestFactory = requestFactory;
-        this.allocator = allocator;
+        this.allocator = allocator != null ? allocator : HeapByteBufferAllocator.INSTANCE;
         this.requestParserFactory = new DefaultHttpRequestParserFactory(null, requestFactory);
-        this.params = null;
+        this.config = config != null ? config : ConnectionConfig.DEFAULT;
     }
 
     /**
@@ -133,15 +136,16 @@ public class SSLNHttpServerConnectionFac
      */
     public SSLNHttpServerConnectionFactory(
             final SSLContext sslcontext,
-            final SSLSetupHandler sslHandler) {
-        this(sslcontext, sslHandler, null, null);
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        this(sslcontext, sslHandler, null, null, config);
     }
 
     /**
      * @since 4.3
      */
-    public SSLNHttpServerConnectionFactory() {
-        this(null, null, null, null);
+    public SSLNHttpServerConnectionFactory(final ConnectionConfig config) {
+        this(null, null, null, null, config);
     }
 
     private SSLContext getDefaultSSLContext() {
@@ -183,19 +187,27 @@ public class SSLNHttpServerConnectionFac
 
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
         SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
-        if (this.params != null) {
-            DefaultNHttpServerConnection conn = createConnection(
-                    ssliosession, this.requestFactory, this.allocator, this.params);
-            int timeout = Config.getInt(this.params, CoreConnectionPNames.SO_TIMEOUT, 0);
-            conn.setSocketTimeout(timeout);
-            return conn;
-        } else {
-            return new DefaultNHttpServerConnection(ssliosession, 8 * 1024,
-                    this.allocator,
-                    null, null, null, null, null,
-                    this.requestParserFactory,
-                    null);
+        CharsetDecoder chardecoder = null;
+        CharsetEncoder charencoder = null;
+        Charset charset = this.config.getCharset();
+        CodingErrorAction malformedInputAction = this.config.getMalformedInputAction() != null ?
+                this.config.getMalformedInputAction() : CodingErrorAction.REPORT;
+        CodingErrorAction unmappableInputAction = this.config.getUnmappableInputAction() != null ?
+                this.config.getUnmappableInputAction() : CodingErrorAction.REPORT;
+        if (charset != null) {
+            chardecoder = charset.newDecoder();
+            chardecoder.onMalformedInput(malformedInputAction);
+            chardecoder.onUnmappableCharacter(unmappableInputAction);
+            charencoder = charset.newEncoder();
+            charencoder.onMalformedInput(malformedInputAction);
+            charencoder.onUnmappableCharacter(unmappableInputAction);
         }
+        return new DefaultNHttpServerConnection(ssliosession, 8 * 1024,
+                this.allocator,
+                chardecoder, charencoder, this.config.getMessageConstraints(),
+                null, null,
+                this.requestParserFactory,
+                null);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java Fri Oct 19 09:53:27 2012
@@ -38,13 +38,12 @@ import org.apache.http.MessageConstraint
 import org.apache.http.ParseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.impl.MessageConstraints;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
 import org.apache.http.nio.NHttpMessageParser;
 import org.apache.http.nio.reactor.SessionInputBuffer;
-import org.apache.http.params.Config;
-import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 import org.apache.http.util.CharArrayBuffer;
@@ -98,10 +97,7 @@ public abstract class AbstractMessagePar
         this.state = READ_HEAD_LINE;
         this.endOfStream = false;
         this.headerBufs = new ArrayList<CharArrayBuffer>();
-        this.constraints = MessageConstraints.custom()
-                .setMaxLineLength(Config.getInt(params, CoreConnectionPNames.MAX_LINE_LENGTH, -1))
-                .setMaxHeaderCount(Config.getInt(params, CoreConnectionPNames.MAX_HEADER_COUNT, -1))
-                .build();
+        this.constraints = HttpParamConfig.getMessageConstraints(params);
         this.lineParser = (lineParser != null) ? lineParser : BasicLineParser.INSTANCE;
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParser.java Fri Oct 19 09:53:27 2012
@@ -33,8 +33,8 @@ import org.apache.http.HttpRequestFactor
 import org.apache.http.ParseException;
 import org.apache.http.RequestLine;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpRequestFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
 import org.apache.http.message.ParserCursor;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParserFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpRequestParserFactory.java Fri Oct 19 09:53:27 2012
@@ -30,8 +30,8 @@ package org.apache.http.impl.nio.codecs;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpRequestFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
 import org.apache.http.nio.NHttpMessageParser;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParser.java Fri Oct 19 09:53:27 2012
@@ -33,8 +33,8 @@ import org.apache.http.HttpResponseFacto
 import org.apache.http.ParseException;
 import org.apache.http.StatusLine;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
 import org.apache.http.message.ParserCursor;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParserFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/DefaultHttpResponseParserFactory.java Fri Oct 19 09:53:27 2012
@@ -30,8 +30,8 @@ package org.apache.http.impl.nio.codecs;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
 import org.apache.http.nio.NHttpMessageParser;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java Fri Oct 19 09:53:27 2012
@@ -33,6 +33,7 @@ import javax.net.ssl.SSLContext;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.nio.DefaultNHttpClientConnectionFactory;
 import org.apache.http.impl.nio.SSLNHttpClientConnectionFactory;
@@ -116,10 +117,11 @@ public class BasicNIOConnFactory impleme
             final SSLContext sslcontext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
-            final ByteBufferAllocator allocator) {
-        this(new DefaultNHttpClientConnectionFactory(responseFactory, allocator),
+            final ByteBufferAllocator allocator,
+            final ConnectionConfig config) {
+        this(new DefaultNHttpClientConnectionFactory(responseFactory, allocator, config),
                 new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, responseFactory,
-                        allocator));
+                        allocator, config));
     }
 
     /**
@@ -127,15 +129,16 @@ public class BasicNIOConnFactory impleme
      */
     public BasicNIOConnFactory(
             final SSLContext sslcontext,
-            final SSLSetupHandler sslHandler) {
-        this(sslcontext, sslHandler, null, null);
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        this(sslcontext, sslHandler, null, null, config);
     }
 
     /**
      * @since 4.3
      */
-    public BasicNIOConnFactory() {
-        this(new DefaultNHttpClientConnectionFactory(null, null), null);
+    public BasicNIOConnFactory(final ConnectionConfig config) {
+        this(new DefaultNHttpClientConnectionFactory(config), null);
     }
 
     public NHttpClientConnection create(final HttpHost route, final IOSession session) throws IOException {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java Fri Oct 19 09:53:27 2012
@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.http.HttpHost;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.pool.AbstractNIOConnPool;
 import org.apache.http.nio.pool.NIOConnFactory;
@@ -115,15 +116,8 @@ public class BasicNIOConnPool extends Ab
      * @since 4.3
      */
     public BasicNIOConnPool(
-            final ConnectingIOReactor ioreactor, int connectTimeout, final TimeUnit tunit) {
-        this(ioreactor, new BasicNIOConnFactory(), connectTimeout, tunit);
-    }
-
-    /**
-     * @since 4.3
-     */
-    public BasicNIOConnPool(final ConnectingIOReactor ioreactor) {
-        this(ioreactor, new BasicNIOConnFactory(), 0, TimeUnit.MILLISECONDS);
+            final ConnectingIOReactor ioreactor, final ConnectionConfig config) {
+        this(ioreactor, new BasicNIOConnFactory(config));
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpMessageParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpMessageParserFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpMessageParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpMessageParserFactory.java Fri Oct 19 09:53:27 2012
@@ -28,7 +28,7 @@
 package org.apache.http.nio;
 
 import org.apache.http.HttpMessage;
-import org.apache.http.impl.MessageConstraints;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.nio.reactor.SessionInputBuffer;
 
 /**

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java Fri Oct 19 09:53:27 2012
@@ -38,7 +38,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
-import org.apache.http.impl.MessageConstraints;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.nio.reactor.SessionInputBufferImpl;
 import org.apache.http.nio.NHttpMessageParser;
 import org.apache.http.nio.reactor.SessionInputBuffer;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java Fri Oct 19 09:53:27 2012
@@ -27,6 +27,7 @@
 package org.apache.http.impl.nio.pool;
 
 import org.apache.http.HttpHost;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOSession;
@@ -49,7 +50,7 @@ public class TestBasicNIOConnPool {
         MockitoAnnotations.initMocks(this);
 
         route = new HttpHost("localhost", 80, "http");
-        connFactory = new BasicNIOConnFactory();
+        connFactory = new BasicNIOConnFactory(ConnectionConfig.DEFAULT);
         pool = new BasicNIOConnPool(reactor, connFactory);
     }
 
@@ -59,7 +60,7 @@ public class TestBasicNIOConnPool {
 
     @Test(expected=IllegalArgumentException.class)
     public void testNullConstructor() throws Exception {
-        pool = new BasicNIOConnPool(null);
+        pool = new BasicNIOConnPool(null, ConnectionConfig.DEFAULT);
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java Fri Oct 19 09:53:27 2012
@@ -35,6 +35,7 @@ import java.util.concurrent.CountDownLat
 import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpResponseInterceptor;
+import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
 import org.apache.http.nio.protocol.HttpAsyncService;
 import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
@@ -66,7 +67,7 @@ public class TestDefaultListeningIOReact
         });
         HttpAsyncService serviceHandler = new HttpAsyncService(httpproc,
                 new UriHttpAsyncRequestHandlerMapper());
-        return new DefaultHttpServerIODispatch(serviceHandler);
+        return new DefaultHttpServerIODispatch(serviceHandler, ConnectionConfig.DEFAULT);
     }
 
     @Test

Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java?rev=1400016&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java Fri Oct 19 09:53:27 2012
@@ -0,0 +1,168 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.config;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CodingErrorAction;
+
+import org.apache.http.Consts;
+import org.apache.http.annotation.Immutable;
+
+/**
+ * HTTP connection configuration.
+ *
+ * @since 4.3
+ */
+@Immutable
+public class ConnectionConfig implements Cloneable {
+
+    public static final ConnectionConfig DEFAULT = new Builder().build();
+
+    private final int connectTimeout;
+    private final Charset charset;
+    private final CodingErrorAction malformedInputAction;
+    private final CodingErrorAction unmappableInputAction;
+    private final MessageConstraints messageConstraints;
+
+    ConnectionConfig(
+            final int connectTimeout,
+            final Charset charset,
+            final CodingErrorAction malformedInputAction,
+            final CodingErrorAction unmappableInputAction,
+            final MessageConstraints messageConstraints) {
+        super();
+        this.connectTimeout = connectTimeout;
+        this.charset = charset;
+        this.malformedInputAction = malformedInputAction;
+        this.unmappableInputAction = unmappableInputAction;
+        this.messageConstraints = messageConstraints;
+    }
+
+    public int getConnectTimeout() {
+        return connectTimeout;
+    }
+
+    public Charset getCharset() {
+        return charset;
+    }
+
+    public CodingErrorAction getMalformedInputAction() {
+        return malformedInputAction;
+    }
+
+    public CodingErrorAction getUnmappableInputAction() {
+        return unmappableInputAction;
+    }
+
+    public MessageConstraints getMessageConstraints() {
+        return messageConstraints;
+    }
+
+    @Override
+    protected ConnectionConfig clone() throws CloneNotSupportedException {
+        return (ConnectionConfig) super.clone();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("[connectTimeout=").append(this.connectTimeout)
+                .append(", charset=").append(this.charset)
+                .append(", malformedInputAction=").append(this.malformedInputAction)
+                .append(", unmappableInputAction=").append(this.unmappableInputAction)
+                .append(", messageConstraints=").append(this.messageConstraints)
+                .append("]");
+        return builder.toString();
+    }
+
+    public static ConnectionConfig.Builder custom() {
+        return new Builder();
+    }
+
+    public static class Builder {
+
+        private int connectTimeout;
+        private Charset charset;
+        private CodingErrorAction malformedInputAction;
+        private CodingErrorAction unmappableInputAction;
+        private MessageConstraints messageConstraints;
+
+        Builder() {
+        }
+
+        public Charset getCharset() {
+            return charset;
+        }
+
+        public Builder setCharset(final Charset charset) {
+            this.charset = charset;
+            return this;
+        }
+
+        public Builder setMalformedInputAction(final CodingErrorAction malformedInputAction) {
+            this.malformedInputAction = malformedInputAction;
+            if (malformedInputAction != null && this.charset == null) {
+                this.charset = Consts.ASCII;
+            }
+            return this;
+        }
+
+        public Builder setUnmappableInputAction(final CodingErrorAction unmappableInputAction) {
+            this.unmappableInputAction = unmappableInputAction;
+            if (unmappableInputAction != null && this.charset == null) {
+                this.charset = Consts.ASCII;
+            }
+            return this;
+        }
+
+        public Builder setMessageConstraints(final MessageConstraints messageConstraints) {
+            this.messageConstraints = messageConstraints;
+            return this;
+        }
+
+        public Builder setConnectTimeout(int connectTimeout) {
+            this.connectTimeout = connectTimeout;
+            return this;
+        }
+
+        public ConnectionConfig build() {
+            Charset cs = charset;
+            if (cs == null && (malformedInputAction != null || unmappableInputAction != null)) {
+                cs = Consts.ASCII;
+            }
+            return new ConnectionConfig(
+                    connectTimeout,
+                    charset,
+                    malformedInputAction,
+                    unmappableInputAction,
+                    messageConstraints);
+        }
+
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java (from r1398785, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/MessageConstraints.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java?p2=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java&p1=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/MessageConstraints.java&r1=1398785&r2=1400016&rev=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/MessageConstraints.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java Fri Oct 19 09:53:27 2012
@@ -25,7 +25,7 @@
  *
  */
 
-package org.apache.http.impl;
+package org.apache.http.config;
 
 import org.apache.http.util.Args;
 
@@ -36,8 +36,7 @@ import org.apache.http.util.Args;
  */
 public class MessageConstraints implements Cloneable {
 
-    public static final MessageConstraints UNLIMITED = new Builder().build();
-    public static final MessageConstraints DEFAULT = UNLIMITED;
+    public static final MessageConstraints DEFAULT = new Builder().build();
 
     private final int maxLineLength;
     private final int maxHeaderCount;

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java?rev=1400016&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java Fri Oct 19 09:53:27 2012
@@ -0,0 +1,188 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.config;
+
+import java.net.SocketOptions;
+
+import org.apache.http.annotation.Immutable;
+
+/**
+ * Socket configuration.
+ *
+ * @since 4.3
+ */
+@Immutable
+public class SocketConfig implements Cloneable {
+
+    public static final SocketConfig DEFAULT = new Builder().build();
+
+    private final int soTimeout;
+    private final boolean soReuseAddress;
+    private final int soLinger;
+    private final boolean soKeepAlive;
+    private final boolean tcpNoDelay;
+
+    SocketConfig(
+            int soTimeout,
+            boolean soReuseAddress,
+            int soLinger,
+            boolean soKeepAlive,
+            boolean tcpNoDelay) {
+        super();
+        this.soTimeout = soTimeout;
+        this.soReuseAddress = soReuseAddress;
+        this.soLinger = soLinger;
+        this.soKeepAlive = soKeepAlive;
+        this.tcpNoDelay = tcpNoDelay;
+    }
+
+    /**
+     * Determines the default socket timeout value for non-blocking I/O operations.
+     * <p/>
+     * Default: <code>0</code> (no timeout)
+     *
+     * @see SocketOptions#SO_TIMEOUT
+     */
+    public int getSoTimeout() {
+        return soTimeout;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#SO_REUSEADDR} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>false</code>
+     *
+     * @see SocketOptions#SO_REUSEADDR
+     */
+    public boolean isSoReuseAddress() {
+        return soReuseAddress;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#SO_LINGER} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>-1</code>
+     *
+     * @see SocketOptions#SO_LINGER
+     */
+    public int getSoLinger() {
+        return soLinger;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#SO_KEEPALIVE} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>-1</code>
+     *
+     * @see SocketOptions#SO_KEEPALIVE
+     */
+    public boolean isSoKeepAlive() {
+        return this.soKeepAlive;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#TCP_NODELAY} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>false</code>
+     *
+     * @see SocketOptions#TCP_NODELAY
+     */
+    public boolean isTcpNoDelay() {
+        return tcpNoDelay;
+    }
+
+    @Override
+    protected SocketConfig clone() throws CloneNotSupportedException {
+        return (SocketConfig) super.clone();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("[soTimeout=").append(this.soTimeout)
+                .append(", soReuseAddress=").append(this.soReuseAddress)
+                .append(", soLinger=").append(this.soLinger)
+                .append(", soKeepAlive=").append(this.soKeepAlive)
+                .append(", tcpNoDelay=").append(this.tcpNoDelay)
+                .append("]");
+        return builder.toString();
+    }
+
+    public static SocketConfig.Builder custom() {
+        return new Builder();
+    }
+
+    public static class Builder {
+
+        private int soTimeout;
+        private boolean soReuseAddress;
+        private int soLinger;
+        private boolean soKeepAlive;
+        private boolean tcpNoDelay;
+
+        Builder() {
+            this.soLinger = -1;
+            this.tcpNoDelay = true;
+        }
+
+        public Builder setSoTimeout(int soTimeout) {
+            this.soTimeout = soTimeout;
+            return this;
+        }
+
+        public Builder setSoReuseAddress(boolean soReuseAddress) {
+            this.soReuseAddress = soReuseAddress;
+            return this;
+        }
+
+        public Builder setSoLinger(int soLinger) {
+            this.soLinger = soLinger;
+            return this;
+        }
+
+        public Builder setSoKeepAlive(boolean soKeepAlive) {
+            this.soKeepAlive = soKeepAlive;
+            return this;
+        }
+
+        public Builder setTcpNoDelay(boolean tcpNoDelay) {
+            this.tcpNoDelay = tcpNoDelay;
+            return this;
+        }
+
+        public SocketConfig build() {
+            return new SocketConfig(soTimeout, soReuseAddress, soLinger, soKeepAlive, tcpNoDelay);
+        }
+
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java Fri Oct 19 09:53:27 2012
@@ -46,6 +46,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpInetConnection;
 import org.apache.http.HttpMessage;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java Fri Oct 19 09:53:27 2012
@@ -41,6 +41,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java Fri Oct 19 09:53:27 2012
@@ -40,6 +40,7 @@ import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpServerConnection;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.entity.DisallowIdentityContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Fri Oct 19 09:53:27 2012
@@ -38,12 +38,12 @@ import org.apache.http.MessageConstraint
 import org.apache.http.ParseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.impl.MessageConstraints;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;
-import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpParamConfig;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.Args;
 import org.apache.http.util.CharArrayBuffer;
@@ -88,10 +88,7 @@ public abstract class AbstractMessagePar
         Args.notNull(buffer, "Session input buffer");
         Args.notNull(params, "HTTP parameters");
         this.sessionBuffer = buffer;
-        this.messageConstraints = MessageConstraints.custom()
-            .setMaxHeaderCount(params.getIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, -1))
-            .setMaxLineLength(params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1))
-            .build();
+        this.messageConstraints = HttpParamConfig.getMessageConstraints(params);
         this.lineParser = (parser != null) ? parser : BasicLineParser.INSTANCE;
         this.headerLines = new ArrayList<CharArrayBuffer>();
         this.state = HEAD_LINE;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java Fri Oct 19 09:53:27 2012
@@ -36,8 +36,8 @@ import org.apache.http.HttpRequestFactor
 import org.apache.http.ParseException;
 import org.apache.http.RequestLine;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpRequestFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParserFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParserFactory.java Fri Oct 19 09:53:27 2012
@@ -30,8 +30,8 @@ package org.apache.http.impl.io;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpRequestFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.HttpMessageParserFactory;
 import org.apache.http.io.SessionInputBuffer;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java Fri Oct 19 09:53:27 2012
@@ -36,8 +36,8 @@ import org.apache.http.NoHttpResponseExc
 import org.apache.http.ParseException;
 import org.apache.http.StatusLine;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.BasicLineParser;
 import org.apache.http.message.LineParser;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParserFactory.java?rev=1400016&r1=1400015&r2=1400016&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParserFactory.java Fri Oct 19 09:53:27 2012
@@ -30,8 +30,8 @@ package org.apache.http.impl.io;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.config.MessageConstraints;
 import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.MessageConstraints;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.HttpMessageParserFactory;
 import org.apache.http.io.SessionInputBuffer;



Mime
View raw message