hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r526417 - /jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
Date Sat, 07 Apr 2007 11:17:52 GMT
Author: olegk
Date: Sat Apr  7 04:17:50 2007
New Revision: 526417

URL: http://svn.apache.org/viewvc?view=rev&rev=526417
Log:
Added mechanism enabling the default HTTP data receiver and transmitter to be overridden /
decorated

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java

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=526417&r1=526416&r2=526417
==============================================================================
--- 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
Sat Apr  7 04:17:50 2007
@@ -94,20 +94,31 @@
         }
 
         this.socket = socket;
-        
-        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
-        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(socket, buffersize);
-        HttpDataReceiver receiver = new SocketHttpDataReceiver(socket, buffersize);
-        transmitter.reset(params);
-        receiver.reset(params);
-        
-        setHttpDataReceiver(receiver);
-        setHttpDataTransmitter(transmitter);
+
+        setHttpDataReceiver(createHttpDataReceiver(params));
+        setHttpDataTransmitter(createHttpDataTransmitter(params));
         setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
         setResponseFactory(new DefaultHttpResponseFactory());
+        
         this.open = true;
     }
 
+    protected HttpDataTransmitter createHttpDataTransmitter(
+            final HttpParams params) throws IOException {
+        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
+        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(this.socket, buffersize);
+        transmitter.reset(params);
+        return transmitter;
+    }
+    
+    protected HttpDataReceiver createHttpDataReceiver(
+            final HttpParams params) throws IOException {
+        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
+        HttpDataReceiver receiver =  new SocketHttpDataReceiver(this.socket, buffersize);
+        receiver.reset(params);
+        return receiver;
+    }
+    
     public boolean isOpen() {
         return this.open;
     }



Mime
View raw message