geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r567279 - /geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java
Date Sat, 18 Aug 2007 15:41:19 GMT
Author: jgenender
Date: Sat Aug 18 08:41:17 2007
New Revision: 567279

URL: http://svn.apache.org/viewvc?view=rev&rev=567279
Log:
Move around the response as a session attr for a response in process

Modified:
    geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java

Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java?view=diff&rev=567279&r1=567278&r2=567279
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java
(original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpResponseDecoder.java
Sat Aug 18 08:41:17 2007
@@ -27,12 +27,19 @@
 
 public class HttpResponseDecoder extends CumulativeProtocolDecoder {
 
+    private final static String CURRENT_RESPONSE = "CURRENT_RESPONSE";
+
     private HttpDecoder httpDecoder = new HttpDecoder();
-    private HttpResponseMessage response = new HttpResponseMessage();
     private boolean headersRead = false;
 
     protected boolean doDecode(IoSession ioSession, ByteBuffer in, ProtocolDecoderOutput
out) throws Exception {
 
+        HttpResponseMessage response = (HttpResponseMessage) ioSession.getAttribute(CURRENT_RESPONSE);
+        if (response == null){
+            response = new HttpResponseMessage();
+            ioSession.setAttribute(CURRENT_RESPONSE, response);
+        }
+
         //Test if we need the response...
         if (response.getStatusCode() == 0) {
             //Read the status header
@@ -71,6 +78,8 @@
         }
 
         out.write(response);
+
+        ioSession.removeAttribute(CURRENT_RESPONSE);
 
         return true;
     }



Mime
View raw message