hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r159023 - in jakarta/httpclient/trunk/http-common/src/java/org/apache/http: HttpDataReceiver.java HttpDataTransmitter.java impl/NIOHttpDataReceiver.java impl/NIOHttpDataTransmitter.java
Date Fri, 25 Mar 2005 14:27:48 GMT
Author: olegk
Date: Fri Mar 25 06:27:48 2005
New Revision: 159023

URL: http://svn.apache.org/viewcvs?view=rev&rev=159023
Log:
Provides ability to reset HTTP data transmitters and receivers

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataReceiver.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataTransmitter.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataTransmitter.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataReceiver.java?view=diff&r1=159022&r2=159023
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataReceiver.java (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataReceiver.java Fri
Mar 25 06:27:48 2005
@@ -31,6 +31,8 @@
 
 import java.io.IOException;
 
+import org.apache.http.params.HttpParams;
+
 /**
  * <p>
  * </p>
@@ -41,6 +43,8 @@
  * @since 4.0
  */
 public interface HttpDataReceiver {
+    
+    void reset(HttpParams params);
 
     int read(byte[] b, int off, int len) throws IOException; 
     

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataTransmitter.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataTransmitter.java?view=diff&r1=159022&r2=159023
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataTransmitter.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpDataTransmitter.java
Fri Mar 25 06:27:48 2005
@@ -31,6 +31,8 @@
 
 import java.io.IOException;
 
+import org.apache.http.params.HttpParams;
+
 /**
  * <p>
  * </p>
@@ -41,6 +43,8 @@
  * @since 4.0
  */
 public interface HttpDataTransmitter {
+
+    void reset(HttpParams params);
 
     void write(byte[] b, int off, int len) throws IOException;
     

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java?view=diff&r1=159022&r2=159023
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
Fri Mar 25 06:27:48 2005
@@ -38,6 +38,8 @@
 import java.nio.charset.CodingErrorAction;
 
 import org.apache.http.HttpDataReceiver;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
 
 /**
  * <p>
@@ -55,7 +57,8 @@
     
     private final ReadableByteChannel channel;
     private final ByteBuffer buffer;
-    private final Charset charset;
+    
+    private Charset charset = null;
     
     protected NIOHttpDataReceiver(final ReadableByteChannel channel, int buffersize) {
         if (channel == null) {
@@ -69,6 +72,11 @@
         this.buffer = ByteBuffer.allocateDirect(buffersize);
         
         this.charset = Charset.forName("US-ASCII");
+    }
+
+    public void reset(final HttpParams params) {
+        HttpProtocolParams protocolParams = new HttpProtocolParams(params);
+        this.charset = Charset.forName(protocolParams.getHttpElementCharset()); 
     }
 
     private CharsetDecoder createCharDecoder() {

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataTransmitter.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataTransmitter.java?view=diff&r1=159022&r2=159023
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataTransmitter.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataTransmitter.java
Fri Mar 25 06:27:48 2005
@@ -39,6 +39,8 @@
 import java.nio.charset.CodingErrorAction;
 
 import org.apache.http.HttpDataTransmitter;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
 
 /**
  * <p>
@@ -57,7 +59,8 @@
 
     private final WritableByteChannel channel;
     private final ByteBuffer buffer;
-    private final Charset charset;
+
+    private Charset charset = null;
 
     protected NIOHttpDataTransmitter(final WritableByteChannel channel, int buffersize) {
         super();
@@ -71,6 +74,11 @@
         }
         this.buffer = ByteBuffer.allocateDirect(buffersize);
         this.charset = Charset.forName("US-ASCII");
+    }
+    
+    public void reset(final HttpParams params) {
+        HttpProtocolParams protocolParams = new HttpProtocolParams(params);
+        this.charset = Charset.forName(protocolParams.getHttpElementCharset()); 
     }
 
     private void flushBuffer() throws IOException {



Mime
View raw message