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/09/04 20:39:31 UTC

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

Author: dkulp
Date: Tue Sep  4 18:39:30 2012
New Revision: 1380800

URL: http://svn.apache.org/viewvc?rev=1380800&view=rev
Log:
Get the redirects working and auth stuff working.

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=1380800&r1=1380799&r2=1380800&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 Tue Sep  4 18:39:30 2012
@@ -144,6 +144,7 @@ public class AsyncHTTPConduit extends UR
         entity.setChunked(true);
         entity.setContentType((String)message.get(Message.CONTENT_TYPE));
         e.setURI(uri);
+        
         e.setEntity(entity);
         
         // Set socket timeout
@@ -355,6 +356,8 @@ public class AsyncHTTPConduit extends UR
                 if (httpResponse == null) {
                     outbuf.shutdown();
                     inbuf.shutdown();
+                    outbuf = null;
+                    inbuf = null;
                     
                     if (exception != null) {
                         if (exception instanceof IOException) {
@@ -531,27 +534,29 @@ public class AsyncHTTPConduit extends UR
             cachingForRetransmission = false; //already cached
             setupWrappedStream();
             cachedStream.writeCacheTo(wrappedStream);
+            wrappedStream.flush();
+            wrappedStream.close();
         }
 
         protected void setupNewConnection(String newURL) throws IOException {
-            
-            
             httpResponse = null;
             isAsync = false;
             exception = null;
             connectionFuture = null;
+            session = null;
             
+            //reset the buffers
+            HeapByteBufferAllocator allocator = new HeapByteBufferAllocator();
+            inbuf = new SharedInputBuffer(4096 * 4, allocator);
+            outbuf = new SharedOutputBuffer(4096 * 4, allocator);
             try {
-                setupConnection(outMessage, new URI(newURL), csPolicy);
+                this.url = new URI(newURL);
+                setupConnection(outMessage, this.url, csPolicy);
                 entity = outMessage.get(CXFHttpRequest.class);
                 basicEntity = (BasicHttpEntity)entity.getEntity();
             } catch (URISyntaxException e) {
                 throw new IOException(e);
             }
-            //reset the buffers
-            HeapByteBufferAllocator allocator = new HeapByteBufferAllocator();
-            inbuf = new SharedInputBuffer(4096 * 4, allocator);
-            outbuf = new SharedOutputBuffer(4096 * 4, allocator);
         }
         
         public SSLContext getSSLContext() throws GeneralSecurityException {