hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r562522 - in /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio: DefaultNHttpClientConnection.java DefaultNHttpServerConnection.java
Date Fri, 03 Aug 2007 16:51:47 GMT
Author: olegk
Date: Fri Aug  3 09:51:45 2007
New Revision: 562522

URL: http://svn.apache.org/viewvc?view=rev&rev=562522
Log:
HTTPCORE-106: Added protected factory methods for instantiating HTTP message parser and writer

Modified:
    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

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=562522&r1=562521&r2=562522
==============================================================================
--- 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 Aug  3 09:51:45 2007
@@ -47,6 +47,8 @@
 import org.apache.http.nio.NHttpMessageWriter;
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.SessionInputBuffer;
+import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
@@ -65,13 +67,26 @@
         if (responseFactory == null) {
             throw new IllegalArgumentException("Response factory may not be null");
         }
-        this.responseParser = new HttpResponseParser(this.inbuf, responseFactory, params);
-        this.requestWriter = new HttpRequestWriter(this.outbuf, params);
+        this.responseParser = createResponseParser(this.inbuf, responseFactory, params);
+        this.requestWriter = createRequestWriter(this.outbuf, params);
         this.hasBufferedInput = false;
         this.hasBufferedOutput = false;
         this.session.setBufferStatus(this);
     }
+    
+    protected NHttpMessageParser createResponseParser(
+            final SessionInputBuffer buffer,
+            final HttpResponseFactory responseFactory,
+            final HttpParams params) {
+        return new HttpResponseParser(buffer, responseFactory, params);
+    }
 
+    protected NHttpMessageWriter createRequestWriter(
+            final SessionOutputBuffer buffer,
+            final HttpParams params) {
+        return new HttpRequestWriter(buffer, params);
+    }
+    
     public void resetInput() {
         this.response = null;
         this.contentDecoder = null;

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=562522&r1=562521&r2=562522
==============================================================================
--- 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 Aug  3 09:51:45 2007
@@ -47,6 +47,8 @@
 import org.apache.http.nio.NHttpServiceHandler;
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.SessionInputBuffer;
+import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
@@ -65,10 +67,23 @@
         if (requestFactory == null) {
             throw new IllegalArgumentException("Request factory may not be null");
         }
-        this.requestParser = new HttpRequestParser(this.inbuf, requestFactory, params);
-        this.responseWriter = new HttpResponseWriter(this.outbuf, params);
+        this.requestParser = createRequestParser(this.inbuf, requestFactory, params);
+        this.responseWriter = createResponseWriter(this.outbuf, params);
     }
 
+    protected NHttpMessageParser createRequestParser(
+            final SessionInputBuffer buffer,
+            final HttpRequestFactory requestFactory,
+            final HttpParams params) {
+        return new HttpRequestParser(buffer, requestFactory, params);
+    }
+    
+    protected HttpResponseWriter createResponseWriter(
+            final SessionOutputBuffer buffer,
+            final HttpParams params) {
+        return new HttpResponseWriter(buffer, params);
+    }
+    
     public void resetInput() {
         this.request = null;
         this.contentDecoder = null;



Mime
View raw message