hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r547802 - in /jakarta/httpcomponents/httpcore/trunk: module-main/src/main/java/org/apache/http/impl/ module-main/src/main/java/org/apache/http/impl/io/ module-main/src/main/java/org/apache/http/io/ module-main/src/test/java/org/apache/http/...
Date Fri, 15 Jun 2007 21:46:01 GMT
Author: olegk
Date: Fri Jun 15 14:45:59 2007
New Revision: 547802

URL: http://svn.apache.org/viewvc?view=rev&rev=547802
Log:
HTTPCORE-64: 
* Made initialization of the low level primitives (such as message parsers) somewhat more consistent
* Cleaned up initialization code in AbstractHttp*Connection and SocketHttp*Connection classes
* Removed #configure(HttpParams) methods

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataReceiver.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataReceiverMockup.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataTransmitterMockup.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
    jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLClientIOEventDispatch.java
    jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
    jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLServerIOEventDispatch.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java Fri Jun 15 14:45:59 2007
@@ -55,6 +55,8 @@
 import org.apache.http.message.BasicRequestLine;
 import org.apache.http.message.BasicStatusLine;
 import org.apache.http.message.BufferedHeader;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.util.CharArrayBuffer;
 import org.apache.http.util.HeaderUtils;
@@ -71,58 +73,49 @@
  */
 public abstract class AbstractHttpClientConnection implements HttpClientConnection {
 
-    private int maxHeaderCount = -1;
-    private int maxGarbageLines = -1;
-
     private final CharArrayBuffer buffer; 
     private final EntitySerializer entityserializer;
     private final EntityDeserializer entitydeserializer;
+    private final HttpResponseFactory responsefactory;
     
-    /*
-     * Dependent interfaces
-     */
-    private HttpResponseFactory responsefactory = null;
     private HttpDataReceiver datareceiver = null;
     private HttpDataTransmitter datatransmitter = null;
 
+    private int maxHeaderCount = -1;
+    private int maxGarbageLines = -1;
+
     public AbstractHttpClientConnection() {
         super();
         this.buffer = new CharArrayBuffer(128);
-        this.entityserializer = new EntitySerializer(
-                new StrictContentLengthStrategy());
-        this.entitydeserializer = new EntityDeserializer(
-                new LaxContentLengthStrategy());
+        this.entityserializer = createEntitySerializer();
+        this.entitydeserializer = createEntityDeserializer();
+        this.responsefactory = createHttpResponseFactory();
     }
     
     protected abstract void assertOpen() throws IllegalStateException;
 
-    protected void setMaxHeaderCount(int maxHeaderCount) {
-        this.maxHeaderCount = maxHeaderCount;
+    protected EntityDeserializer createEntityDeserializer() {
+        return new EntityDeserializer(new LaxContentLengthStrategy());
     }
-    
-    protected void setMaxGarbageLines(int maxGarbageLines) {
-        this.maxGarbageLines = maxGarbageLines;
-    }
-    
-    protected void setResponseFactory(final HttpResponseFactory responsefactory) {
-        if (responsefactory == null) {
-            throw new IllegalArgumentException("Factory may not be null");
-        }
-        this.responsefactory = responsefactory;
+
+    protected EntitySerializer createEntitySerializer() {
+        return new EntitySerializer(new StrictContentLengthStrategy());
     }
 
-    protected void setHttpDataReceiver(final HttpDataReceiver datareceiver) {
-        if (datareceiver == null) {
-            throw new IllegalArgumentException("HTTP data receiver may not be null");
-        }
-        this.datareceiver = datareceiver;
+    protected HttpResponseFactory createHttpResponseFactory() {
+        return new DefaultHttpResponseFactory();
     }
 
-    protected void setHttpDataTransmitter(final HttpDataTransmitter datatransmitter) {
-        if (datatransmitter == null) {
-            throw new IllegalArgumentException("HTTP data transmitter may not be null");
-        }
+    protected void init(
+            final HttpDataReceiver datareceiver,
+            final HttpDataTransmitter datatransmitter,
+            final HttpParams params) {
+        this.datareceiver = datareceiver;
         this.datatransmitter = datatransmitter;
+        this.maxHeaderCount = params.getIntParameter(
+                HttpConnectionParams.MAX_HEADER_COUNT, -1);
+        this.maxGarbageLines = params.getIntParameter(
+                HttpConnectionParams.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE);
     }
     
     public boolean isResponseAvailable(int timeout) throws IOException {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java Fri Jun 15 14:45:59 2007
@@ -54,6 +54,8 @@
 import org.apache.http.message.BasicRequestLine;
 import org.apache.http.message.BasicStatusLine;
 import org.apache.http.message.BufferedHeader;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
 import org.apache.http.util.CharArrayBuffer;
 import org.apache.http.util.HeaderUtils;
 
@@ -69,55 +71,48 @@
  */
 public abstract class AbstractHttpServerConnection implements HttpServerConnection {
 
-    private int maxHeaderCount = -1;
-    
     private final CharArrayBuffer buffer; 
     private final EntitySerializer entityserializer;
     private final EntityDeserializer entitydeserializer;
+    private final HttpRequestFactory requestfactory; 
     
-    /*
-     * Dependent interfaces
-     */
-    private HttpRequestFactory requestfactory = null; 
     private HttpDataReceiver datareceiver = null;
     private HttpDataTransmitter datatransmitter = null;
 
+    private int maxHeaderCount = -1;
+    
     public AbstractHttpServerConnection() {
         super();
         this.buffer = new CharArrayBuffer(128);
-        this.entityserializer = new EntitySerializer(
-                new StrictContentLengthStrategy());
-        this.entitydeserializer = new EntityDeserializer(
-                new LaxContentLengthStrategy());
+        this.entityserializer = createEntitySerializer();
+        this.entitydeserializer = createEntityDeserializer();
+        this.requestfactory = createHttpRequestFactory();
     }
     
     protected abstract void assertOpen() throws IllegalStateException;
 
-    protected void setMaxHeaderCount(int maxHeaderCount) {
-        this.maxHeaderCount = maxHeaderCount;
+    protected EntityDeserializer createEntityDeserializer() {
+        return new EntityDeserializer(new LaxContentLengthStrategy());
     }
-    
-    protected void setRequestFactory(final HttpRequestFactory requestfactory) {
-        if (requestfactory == null) {
-            throw new IllegalArgumentException("Factory may not be null");
-        }
-        this.requestfactory = requestfactory;
+
+    protected EntitySerializer createEntitySerializer() {
+        return new EntitySerializer(new StrictContentLengthStrategy());
     }
 
-    protected void setHttpDataReceiver(final HttpDataReceiver datareceiver) {
-        if (datareceiver == null) {
-            throw new IllegalArgumentException("HTTP data receiver may not be null");
-        }
-        this.datareceiver = datareceiver;
+    protected HttpRequestFactory createHttpRequestFactory() {
+        return new DefaultHttpRequestFactory();
     }
 
-    protected void setHttpDataTransmitter(final HttpDataTransmitter datatransmitter) {
-        if (datatransmitter == null) {
-            throw new IllegalArgumentException("HTTP data transmitter may not be null");
-        }
+    protected void init(
+            final HttpDataReceiver datareceiver,
+            final HttpDataTransmitter datatransmitter,
+            final HttpParams params) {
+        this.datareceiver = datareceiver;
         this.datatransmitter = datatransmitter;
+        this.maxHeaderCount = params.getIntParameter(
+                HttpConnectionParams.MAX_HEADER_COUNT, -1);
     }
-
+    
     public HttpRequest receiveRequestHeader() 
             throws HttpException, IOException {
         assertOpen();

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java Fri Jun 15 14:45:59 2007
@@ -62,7 +62,7 @@
         StringBuffer buffer = new StringBuffer();
         buffer.append("[");
         if (isOpen()) {
-            buffer.append(this.socket.getInetAddress());
+            buffer.append(getRemotePort());
         } else {
             buffer.append("closed");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java Fri Jun 15 14:45:59 2007
@@ -60,7 +60,7 @@
         StringBuffer buffer = new StringBuffer();
         buffer.append("[");
         if (isOpen()) {
-            buffer.append(this.socket.getInetAddress());
+            buffer.append(getRemotePort());
         } else {
             buffer.append("closed");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java Fri Jun 15 14:45:59 2007
@@ -57,8 +57,8 @@
 public class SocketHttpClientConnection 
         extends AbstractHttpClientConnection implements HttpInetConnection {
 
-    protected volatile boolean open;
-    protected Socket socket = null;
+    private volatile boolean open;
+    private Socket socket = null;
     
     public SocketHttpClientConnection() {
         super();
@@ -76,6 +76,20 @@
         }
     }
 
+    protected HttpDataReceiver createHttpDataReceiver(
+            final Socket socket, 
+            int buffersize,
+            final HttpParams params) throws IOException {
+        return new SocketHttpDataReceiver(socket, buffersize, params);
+    }
+    
+    protected HttpDataTransmitter createHttpDataTransmitter(
+            final Socket socket, 
+            int buffersize,
+            final HttpParams params) throws IOException {
+        return new SocketHttpDataTransmitter(socket, buffersize, params);
+    }
+    
     protected void bind(
             final Socket socket, 
             final HttpParams params) throws IOException {
@@ -95,35 +109,22 @@
 
         this.socket = socket;
 
-        setHttpDataReceiver(createHttpDataReceiver(params));
-        setHttpDataTransmitter(createHttpDataTransmitter(params));
-        setMaxHeaderCount(params.getIntParameter(
-                HttpConnectionParams.MAX_HEADER_COUNT, -1));
-        setMaxGarbageLines(params.getIntParameter(
-                HttpConnectionParams.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE));
-        setResponseFactory(new DefaultHttpResponseFactory());
+        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
+
+        init(
+                createHttpDataReceiver(socket, buffersize, params), 
+                createHttpDataTransmitter(socket, buffersize, params),
+                params);
         
         this.open = true;
     }
 
-    protected HttpDataTransmitter createHttpDataTransmitter(
-            final HttpParams params) throws IOException {
-        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
-        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(this.socket, buffersize);
-        transmitter.configure(params);
-        return transmitter;
-    }
-    
-    protected HttpDataReceiver createHttpDataReceiver(
-            final HttpParams params) throws IOException {
-        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
-        HttpDataReceiver receiver =  new SocketHttpDataReceiver(this.socket, buffersize);
-        receiver.configure(params);
-        return receiver;
-    }
-    
     public boolean isOpen() {
         return this.open;
+    }
+    
+    protected Socket getSocket() {
+        return this.socket;
     }
 
     public InetAddress getLocalAddress() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java Fri Jun 15 14:45:59 2007
@@ -57,8 +57,8 @@
 public class SocketHttpServerConnection extends 
         AbstractHttpServerConnection implements HttpInetConnection {
 
-    protected volatile boolean open;
-    protected Socket socket = null;
+    private volatile boolean open;
+    private Socket socket = null;
     
     public SocketHttpServerConnection() {
         super();
@@ -75,7 +75,21 @@
             throw new IllegalStateException("Connection is not open");
         }
     }
-
+    
+    protected HttpDataReceiver createHttpDataReceiver(
+            final Socket socket, 
+            int buffersize,
+            final HttpParams params) throws IOException {
+        return new SocketHttpDataReceiver(socket, buffersize, params);
+    }
+    
+    protected HttpDataTransmitter createHttpDataTransmitter(
+            final Socket socket, 
+            int buffersize,
+            final HttpParams params) throws IOException {
+        return new SocketHttpDataTransmitter(socket, buffersize, params);
+    }
+    
     protected void bind(final Socket socket, final HttpParams params) throws IOException {
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");
@@ -94,16 +108,17 @@
         this.socket = socket;
         
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
-        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(socket, buffersize);
-        HttpDataReceiver receiver = new SocketHttpDataReceiver(socket, buffersize);
-        transmitter.configure(params);
-        receiver.configure(params);
         
-        setHttpDataReceiver(receiver);
-        setHttpDataTransmitter(transmitter);
-        setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
-        setRequestFactory(new DefaultHttpRequestFactory());
+        init(
+                createHttpDataReceiver(socket, buffersize, params), 
+                createHttpDataTransmitter(socket, buffersize, params),
+                params);
+        
         this.open = true;
+    }
+
+    protected Socket getSocket() {
+        return this.socket;
     }
 
     public boolean isOpen() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java Fri Jun 15 14:45:59 2007
@@ -64,18 +64,25 @@
     
     private HttpTransportMetricsImpl metrics;
     
-    protected void init(final InputStream instream, int buffersize) {
+    protected void init(final InputStream instream, int buffersize, final HttpParams params) {
         if (instream == null) {
             throw new IllegalArgumentException("Input stream may not be null");
         }
         if (buffersize <= 0) {
             throw new IllegalArgumentException("Buffer size may not be negative or zero");
         }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
         this.instream = instream;
         this.buffer = new byte[buffersize];
         this.bufferpos = 0;
         this.bufferlen = 0;
         this.linebuffer = new ByteArrayBuffer(buffersize);
+        this.charset = HttpProtocolParams.getHttpElementCharset(params);
+        this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
+                     || this.charset.equalsIgnoreCase(HTTP.ASCII);
+        this.maxLineLen = params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1);
         this.metrics = new HttpTransportMetricsImpl();
     }
     
@@ -256,13 +263,6 @@
         }
     }
     
-    public void configure(final HttpParams params) {
-        this.charset = HttpProtocolParams.getHttpElementCharset(params);
-        this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
-                     || this.charset.equalsIgnoreCase(HTTP.ASCII);
-        this.maxLineLen = params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1);
-    }
-
     public HttpTransportMetrics getMetrics() {
         return this.metrics;
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java Fri Jun 15 14:45:59 2007
@@ -62,15 +62,21 @@
     
     private HttpTransportMetricsImpl metrics;
     
-    protected void init(final OutputStream outstream, int buffersize) {
+    protected void init(final OutputStream outstream, int buffersize, final HttpParams params) {
         if (outstream == null) {
             throw new IllegalArgumentException("Input stream may not be null");
         }
         if (buffersize <= 0) {
             throw new IllegalArgumentException("Buffer size may not be negative or zero");
         }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
         this.outstream = outstream;
         this.buffer = new ByteArrayBuffer(buffersize);
+        this.charset = HttpProtocolParams.getHttpElementCharset(params); 
+        this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
+                     || this.charset.equalsIgnoreCase(HTTP.ASCII);
         this.metrics = new HttpTransportMetricsImpl();
     }
     
@@ -165,12 +171,6 @@
         write(CRLF);
     }
     
-    public void configure(final HttpParams params) {
-        this.charset = HttpProtocolParams.getHttpElementCharset(params); 
-        this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
-                     || this.charset.equalsIgnoreCase(HTTP.ASCII);
-    }
-
     public HttpTransportMetrics getMetrics() {
         return this.metrics;
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataReceiver.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataReceiver.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataReceiver.java Fri Jun 15 14:45:59 2007
@@ -35,6 +35,8 @@
 import java.io.InterruptedIOException;
 import java.net.Socket;
 
+import org.apache.http.params.HttpParams;
+
 
 /**
  * A data receiver using a Java {@link Socket} and traditional IO.
@@ -73,7 +75,10 @@
     
     private final Socket socket;
     
-    public SocketHttpDataReceiver(final Socket socket, int buffersize) throws IOException {
+    public SocketHttpDataReceiver(
+            final Socket socket, 
+            int buffersize, 
+            final HttpParams params) throws IOException {
         super();
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");
@@ -85,7 +90,7 @@
         if (buffersize < 1024) {
             buffersize = 1024;
         }
-        init(socket.getInputStream(), buffersize);
+        init(socket.getInputStream(), buffersize, params);
     }
     
     public boolean isDataAvailable(int timeout) throws IOException {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataTransmitter.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataTransmitter.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketHttpDataTransmitter.java Fri Jun 15 14:45:59 2007
@@ -34,6 +34,8 @@
 import java.io.IOException;
 import java.net.Socket;
 
+import org.apache.http.params.HttpParams;
+
 
 /**
  * A data transmitter using a Java {@link Socket} and traditional IO.
@@ -46,7 +48,10 @@
  */
 public class SocketHttpDataTransmitter extends AbstractHttpDataTransmitter {
 
-    public SocketHttpDataTransmitter(final Socket socket, int buffersize) throws IOException {
+    public SocketHttpDataTransmitter(
+            final Socket socket, 
+            int buffersize,
+            final HttpParams params) throws IOException {
         super();
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");
@@ -57,7 +62,7 @@
         if (buffersize < 1024) {
             buffersize = 1024;
         }
-        init(socket.getOutputStream(), buffersize);
+        init(socket.getOutputStream(), buffersize, params);
     }
     
 }

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java Fri Jun 15 14:45:59 2007
@@ -33,7 +33,6 @@
 
 import java.io.IOException;
 
-import org.apache.http.params.HttpParams;
 import org.apache.http.util.CharArrayBuffer;
 
 /**
@@ -49,8 +48,6 @@
  */
 public interface HttpDataReceiver {
     
-    void configure(HttpParams params);
-
     int read(byte[] b, int off, int len) throws IOException; 
     
     int read(byte[] b) throws IOException; 

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java Fri Jun 15 14:45:59 2007
@@ -33,7 +33,6 @@
 
 import java.io.IOException;
 
-import org.apache.http.params.HttpParams;
 import org.apache.http.util.CharArrayBuffer;
 
 /**
@@ -48,8 +47,6 @@
  * @since 4.0
  */
 public interface HttpDataTransmitter {
-
-    void configure(HttpParams params);
 
     void write(byte[] b, int off, int len) throws IOException;
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java Fri Jun 15 14:45:59 2007
@@ -70,7 +70,7 @@
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         new HttpDataTransmitterMockup(out); 
         try {
-            new HttpDataTransmitterMockup(null); 
+            new HttpDataTransmitterMockup(null, new BasicHttpParams()); 
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
@@ -316,16 +316,14 @@
         HttpParams params = new BasicHttpParams();
         String s = "a very looooooooooooooooooooooooooooooooooooooong line\r\n     ";
         byte[] tmp = s.getBytes("US-ASCII"); 
-        HttpDataReceiverMockup receiver1 = new HttpDataReceiverMockup(tmp, 5);
         // no limit
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
-        receiver1.configure(params);
+        HttpDataReceiverMockup receiver1 = new HttpDataReceiverMockup(tmp, 5, params);
         assertNotNull(receiver1.readLine());
         
-        HttpDataReceiverMockup receiver2 = new HttpDataReceiverMockup(tmp, 5);
         // 15 char limit
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
-        receiver2.configure(params);
+        HttpDataReceiverMockup receiver2 = new HttpDataReceiverMockup(tmp, 5, params);
         try {
             receiver2.readLine();
             fail("IOException should have been thrown");
@@ -361,8 +359,7 @@
         HttpParams params = new BasicHttpParams(null);
         HttpProtocolParams.setHttpElementCharset(params, "UTF-8");
         
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
-        transmitter.configure(params);
+        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup(params);
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16); 
         for (int i = 0; i < 10; i++) {
@@ -379,8 +376,7 @@
         transmitter.flush();
         
         HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(
-        		transmitter.getData());
-        receiver.configure(params);
+        		transmitter.getData(), params);
 
         for (int i = 0; i < 10; i++) {
             assertEquals(s1, receiver.readLine());
@@ -397,8 +393,7 @@
         HttpParams params = new BasicHttpParams(null);
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
         
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
-        transmitter.configure(params);
+        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup(params);
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16); 
         for (int i = 0; i < 10; i++) {
@@ -409,9 +404,9 @@
         transmitter.flush();
         
         HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(
-                transmitter.getData());
+                transmitter.getData(),
+                params);
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
-        receiver.configure(params);
 
         for (int i = 0; i < 10; i++) {
             assertEquals(s1, receiver.readLine());

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataReceiverMockup.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataReceiverMockup.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataReceiverMockup.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataReceiverMockup.java Fri Jun 15 14:45:59 2007
@@ -37,6 +37,8 @@
 import java.io.UnsupportedEncodingException;
 
 import org.apache.http.impl.io.AbstractHttpDataReceiver;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
 
 /**
  * {@link HttpDataInputStream} mockup implementation.
@@ -47,27 +49,74 @@
 
     public static int BUFFER_SIZE = 16;
     
-    public HttpDataReceiverMockup(final InputStream instream, int buffersize) {
+    public HttpDataReceiverMockup(
+            final InputStream instream, 
+            int buffersize, 
+            final HttpParams params) {
         super();
-        init(instream, buffersize);
+        init(instream, buffersize, params);
     }
 
-    public HttpDataReceiverMockup(final byte[] bytes) {
-        this(bytes, BUFFER_SIZE);
+    public HttpDataReceiverMockup(
+            final InputStream instream, 
+            int buffersize) {
+        this(instream, buffersize, new BasicHttpParams());
     }
 
-    public HttpDataReceiverMockup(final byte[] bytes, int buffersize) {
-        this(new ByteArrayInputStream(bytes), buffersize);
+    public HttpDataReceiverMockup(
+            final byte[] bytes, 
+            final HttpParams params) {
+        this(bytes, BUFFER_SIZE, params);
     }
 
-    public HttpDataReceiverMockup(final String s, final String charset, int buffersize) 
+    public HttpDataReceiverMockup(
+            final byte[] bytes) {
+        this(bytes, BUFFER_SIZE, new BasicHttpParams());
+    }
+
+    public HttpDataReceiverMockup(
+            final byte[] bytes, 
+            int buffersize, 
+            final HttpParams params) {
+        this(new ByteArrayInputStream(bytes), buffersize, params);
+    }
+
+    public HttpDataReceiverMockup(
+            final byte[] bytes, 
+            int buffersize) {
+        this(new ByteArrayInputStream(bytes), buffersize, new BasicHttpParams());
+    }
+
+    public HttpDataReceiverMockup(
+            final String s, 
+            final String charset, 
+            int buffersize,
+            final HttpParams params) 
+        throws UnsupportedEncodingException {
+        this(s.getBytes(charset), buffersize, params);
+    }
+    
+    public HttpDataReceiverMockup(
+            final String s, 
+            final String charset, 
+            int buffersize) 
+        throws UnsupportedEncodingException {
+        this(s.getBytes(charset), buffersize, new BasicHttpParams());
+    }
+    
+    public HttpDataReceiverMockup(
+            final String s, 
+            final String charset,
+            final HttpParams params) 
         throws UnsupportedEncodingException {
-        this(s.getBytes(charset), buffersize);
+        this(s.getBytes(charset), params);
     }
     
-    public HttpDataReceiverMockup(final String s, final String charset) 
+    public HttpDataReceiverMockup(
+            final String s, 
+            final String charset) 
         throws UnsupportedEncodingException {
-        this(s.getBytes(charset));
+        this(s.getBytes(charset), new BasicHttpParams());
     
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataTransmitterMockup.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataTransmitterMockup.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataTransmitterMockup.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/HttpDataTransmitterMockup.java Fri Jun 15 14:45:59 2007
@@ -35,6 +35,8 @@
 import java.io.OutputStream;
 
 import org.apache.http.impl.io.AbstractHttpDataTransmitter;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
 
 /**
  * {@link HttpDataTransmitter} mockup implementation.
@@ -46,18 +48,39 @@
     private ByteArrayOutputStream buffer = new ByteArrayOutputStream();
     public static int BUFFER_SIZE = 16;
     
-    public HttpDataTransmitterMockup(final OutputStream outstream, int buffersize) {
+    public HttpDataTransmitterMockup(
+            final OutputStream outstream, 
+            int buffersize,
+            final HttpParams params) {
         super();
-        init(outstream, buffersize);
+        init(outstream, buffersize, params);
     }
 
-    public HttpDataTransmitterMockup(final ByteArrayOutputStream buffer) {
-        this(buffer, BUFFER_SIZE);
+    public HttpDataTransmitterMockup(
+            final OutputStream outstream, 
+            int buffersize) {
+        this(outstream, buffersize, new BasicHttpParams());
+    }
+
+    public HttpDataTransmitterMockup(
+            final ByteArrayOutputStream buffer,
+            final HttpParams params) {
+        this(buffer, BUFFER_SIZE, params);
         this.buffer = buffer;
     }
 
+    public HttpDataTransmitterMockup(
+            final ByteArrayOutputStream buffer) {
+        this(buffer, BUFFER_SIZE, new BasicHttpParams());
+        this.buffer = buffer;
+    }
+
+    public HttpDataTransmitterMockup(final HttpParams params) {
+        this(new ByteArrayOutputStream(), params);
+    }
+
     public HttpDataTransmitterMockup() {
-        this(new ByteArrayOutputStream());
+        this(new ByteArrayOutputStream(), new BasicHttpParams());
     }
 
     public byte[] getData() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java Fri Jun 15 14:45:59 2007
@@ -66,8 +66,7 @@
         if (responseFactory == null) {
             throw new IllegalArgumentException("Response factory may not be null");
         }
-        this.responseParser = new HttpResponseParser(this.inbuf, responseFactory);
-        this.responseParser.configure(params);
+        this.responseParser = new HttpResponseParser(this.inbuf, responseFactory, params);
         this.hasBufferedInput = false;
         this.hasBufferedOutput = false;
         this.session.setBufferStatus(this);

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java Fri Jun 15 14:45:59 2007
@@ -66,8 +66,7 @@
         if (requestFactory == null) {
             throw new IllegalArgumentException("Request factory may not be null");
         }
-        this.requestParser = new HttpRequestParser(this.inbuf, requestFactory);
-        this.requestParser.configure(params);
+        this.requestParser = new HttpRequestParser(this.inbuf, requestFactory, params);
     }
 
     public void resetInput() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java Fri Jun 15 14:45:59 2007
@@ -63,22 +63,25 @@
     private int maxLineLen = -1;
     private int maxHeaderCount = -1;
 
-    public HttpMessageParser(final SessionInputBuffer buffer) {
+    public HttpMessageParser(final SessionInputBuffer buffer, final HttpParams params) {
         super();
         if (buffer == null) {
             throw new IllegalArgumentException("Session input buffer may not be null");
         }
+        if (buffer == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
         this.buffer = buffer;
         this.state = READ_HEAD_LINE;
         this.endOfStream = false;
         this.headerBufs = new ArrayList();        
-    }
-    
-    public void configure(final HttpParams params) {
         this.maxLineLen = params.getIntParameter(
                 HttpConnectionParams.MAX_LINE_LENGTH, -1);
         this.maxHeaderCount = params.getIntParameter(
                 HttpConnectionParams.MAX_HEADER_COUNT, -1);
+    }
+    
+    public void configure() {
     }
     
     public void reset() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java Fri Jun 15 14:45:59 2007
@@ -36,6 +36,7 @@
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.RequestLine;
 import org.apache.http.message.BasicRequestLine;
+import org.apache.http.params.HttpParams;
 import org.apache.http.impl.nio.reactor.SessionInputBuffer;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -45,8 +46,9 @@
     
     public HttpRequestParser(
             final SessionInputBuffer buffer, 
-            final HttpRequestFactory requestFactory) {
-        super(buffer);
+            final HttpRequestFactory requestFactory,
+            final HttpParams params) {
+        super(buffer, params);
         if (requestFactory == null) {
             throw new IllegalArgumentException("Request factory may not be null");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java Fri Jun 15 14:45:59 2007
@@ -36,6 +36,7 @@
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.StatusLine;
 import org.apache.http.message.BasicStatusLine;
+import org.apache.http.params.HttpParams;
 import org.apache.http.impl.nio.reactor.SessionInputBuffer;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -45,8 +46,9 @@
     
     public HttpResponseParser(
             final SessionInputBuffer buffer,
-            final HttpResponseFactory responseFactory) {
-        super(buffer);
+            final HttpResponseFactory responseFactory,
+            final HttpParams params) {
+        super(buffer, params);
         if (responseFactory == null) {
             throw new IllegalArgumentException("Response factory may not be null");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java Fri Jun 15 14:45:59 2007
@@ -89,9 +89,10 @@
     }
 
     public void testSimpleParsing() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
         HttpRequest request = (HttpRequest) requestParser.parse();
         assertNotNull(request);
@@ -100,9 +101,10 @@
     }
 
     public void testParsingChunkedMessages() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
 
         requestParser.fillBuffer(newChannel("GET /whatev"));
         HttpRequest request = (HttpRequest) requestParser.parse();
@@ -120,9 +122,10 @@
     }
 
     public void testParsingFoldedHeaders() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
 
         requestParser.fillBuffer(newChannel("GET /whatev"));
         HttpRequest request = (HttpRequest) requestParser.parse();
@@ -149,9 +152,10 @@
     }
     
     public void testParsingBadlyFoldedFirstHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
 
         requestParser.fillBuffer(newChannel("GET /whatev"));
         HttpRequest request = (HttpRequest) requestParser.parse();
@@ -175,9 +179,10 @@
     }
     
     public void testParsingEmptyFoldedHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
 
         requestParser.fillBuffer(newChannel("GET /whatev"));
         HttpRequest request = (HttpRequest) requestParser.parse();
@@ -204,9 +209,10 @@
     }
     
     public void testParsingIncompleteRequestLine() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0");
         requestParser.fillBuffer(channel);
@@ -217,9 +223,10 @@
     }
     
     public void testParsingIncompleteHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: whatever");
         requestParser.fillBuffer(channel);
@@ -231,9 +238,10 @@
     }
     
     public void testParsingInvalidRequestLine() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         
         ReadableByteChannel channel = newChannel("GET garbage\r\n");
         requestParser.fillBuffer(channel);
@@ -246,9 +254,10 @@
     }
     
     public void testParsingInvalidStatusLine() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
-        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory);
+        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory, params);
         
         ReadableByteChannel channel = newChannel("HTTP 200 OK\r\n");
         responseParser.fillBuffer(channel);
@@ -261,9 +270,10 @@
     }
     
     public void testParsingInvalidHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
-        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory);
+        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory, params);
         
         ReadableByteChannel channel = newChannel("HTTP/1.0 200 OK\r\nstuff\r\n\r\n");
         responseParser.fillBuffer(channel);
@@ -276,9 +286,10 @@
     }
     
     public void testResetParser() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n");
         requestParser.fillBuffer(channel);
@@ -298,27 +309,28 @@
     }
     
     public void testInvalidConstructor() {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         try {
-            new HttpRequestParser(null, null);
+            new HttpRequestParser(null, null, params);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // ignore
         }
         try {
-            new HttpRequestParser(inbuf, null);
+            new HttpRequestParser(inbuf, null, params);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // ignore
         }
         try {
-            new HttpResponseParser(null, null);
+            new HttpResponseParser(null, null, params);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // ignore
         }
         try {
-            new HttpResponseParser(inbuf, null);
+            new HttpResponseParser(inbuf, null, params);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // ignore
@@ -329,16 +341,15 @@
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
-        requestParser.configure(params);        
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
 
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
-        requestParser.configure(params);        
+        requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         try {
             requestParser.fillBuffer(newChannel("GET /loooooooooooooooong HTTP/1.0\r\nHeader: one\r\n\r\n"));
             requestParser.parse();
@@ -351,16 +362,15 @@
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
-        requestParser.configure(params);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
 
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
-        requestParser.configure(params);
+        requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
@@ -376,11 +386,10 @@
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
         params.setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 2);
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);        
-        requestParser.configure(params);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         try {
             requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n 23456789012345\r\n 23456789012345\r\n 23456789012345\r\n\r\n"));
             requestParser.parse();
@@ -393,10 +402,9 @@
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
         params.setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 2);
-        requestParser.configure(params);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\nHeader: two\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLClientIOEventDispatch.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLClientIOEventDispatch.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLClientIOEventDispatch.java Fri Jun 15 14:45:59 2007
@@ -109,7 +109,7 @@
         this.handler.connected(conn, attachment);
 
         try {
-            sslSession.initialize(SSLMode.CLIENT, this.params);
+            sslSession.bind(SSLMode.CLIENT, this.params);
         } catch (SSLException ex) {
             this.handler.exception(conn, ex);
             sslSession.shutdown();

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java Fri Jun 15 14:45:59 2007
@@ -110,7 +110,7 @@
         this.outPlain = ByteBuffer.allocateDirect(appBuffersize);
     }
     
-    public synchronized void initialize(
+    public synchronized void bind(
             final SSLMode mode, 
             final HttpParams params) throws SSLException {
         if (params == null) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLServerIOEventDispatch.java?view=diff&rev=547802&r1=547801&r2=547802
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLServerIOEventDispatch.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLServerIOEventDispatch.java Fri Jun 15 14:45:59 2007
@@ -108,7 +108,7 @@
         this.handler.connected(conn);
 
         try {
-            sslSession.initialize(SSLMode.SERVER, this.params);
+            sslSession.bind(SSLMode.SERVER, this.params);
         } catch (SSLException ex) {
             this.handler.exception(conn, ex);
             sslSession.shutdown();



Mime
View raw message