You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/08/31 20:37:59 UTC

svn commit: r1379547 - /cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java

Author: dkulp
Date: Fri Aug 31 18:37:59 2012
New Revision: 1379547

URL: http://svn.apache.org/viewvc?rev=1379547&view=rev
Log:
Completely reset on retransmit
Read cookie headers

Modified:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1379547&r1=1379546&r2=1379547&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java Fri Aug 31 18:37:59 2012
@@ -155,10 +155,11 @@ public class AsyncHTTPConduit extends UR
     
     
     class AsyncWrappedOutputStream extends WrappedOutputStream {
-        final CXFHttpRequest entity;
-        final BasicHttpEntity basicEntity;
         final HTTPClientPolicy csPolicy;
 
+        CXFHttpRequest entity;
+        BasicHttpEntity basicEntity;
+
         boolean isAsync;
         SharedInputBuffer inbuf;
         SharedOutputBuffer outbuf;
@@ -402,8 +403,8 @@ public class AsyncHTTPConduit extends UR
             return getHttpResponse().getStatusLine().getReasonPhrase();
         }
         
-        private String readHeaders(Headers h) {
-            Header headers[] = httpResponse.getAllHeaders();
+        private String readHeaders(Headers h) throws IOException {
+            Header headers[] = getHttpResponse().getAllHeaders();
             h.headerMap().clear();
             String ct = null;
             for (Header header : headers) {
@@ -420,9 +421,10 @@ public class AsyncHTTPConduit extends UR
             return ct;
         }
         
-        protected void updateResponseHeaders(Message inMessage) {
+        protected void updateResponseHeaders(Message inMessage) throws IOException {
             Headers h = new Headers(inMessage);
             inMessage.put(Message.CONTENT_TYPE, readHeaders(h));
+            cookies.readFromHeaders(h);
         }
         
         protected InputStream getPartialResponse() throws IOException {
@@ -461,7 +463,7 @@ public class AsyncHTTPConduit extends UR
             return in;
         }
         
-        protected void updateCookiesBeforeRetransmit() {
+        protected void updateCookiesBeforeRetransmit() throws IOException {
             Headers h = new Headers();
             readHeaders(h);
             cookies.readFromHeaders(h);
@@ -474,11 +476,16 @@ public class AsyncHTTPConduit extends UR
         }
 
         protected void setupNewConnection(String newURL) throws IOException {
+            
+            
             httpResponse = null;
             isAsync = false;
             exception = null;
+            
             try {
-                entity.setURI(new URI(newURL));
+                setupConnection(outMessage, new URI(newURL), csPolicy);
+                entity = outMessage.get(CXFHttpRequest.class);
+                basicEntity = (BasicHttpEntity)entity.getEntity();
             } catch (URISyntaxException e) {
                 throw new IOException(e);
             }