You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2006/08/23 19:55:55 UTC

svn commit: r434104 - /jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java

Author: rolandw
Date: Wed Aug 23 10:55:54 2006
New Revision: 434104

URL: http://svn.apache.org/viewvc?rev=434104&view=rev
Log:
added flexibility for manual testing

Modified:
    jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java

Modified: jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java?rev=434104&r1=434103&r2=434104&view=diff
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java (original)
+++ jakarta/httpcomponents/httpasync/trunk/src/examples/org/apache/http/examples/NotifiedAsyncGet.java Wed Aug 23 10:55:54 2006
@@ -303,17 +303,18 @@
 
         // we know there is no error, so the response can not be null
         HttpResponse response = handle.getResponse();
+        System.out.println("<< Response: " + response.getStatusLine());
 
-        System.out.println
-            ("<< Response: " + response.getStatusLine());
-        System.out.println
-            (EntityUtils.toString(response.getEntity()));
-        /*
-        byte[] data = new byte[100];
-        int count = response.getEntity().getContent().read(data);
-        String s = new String(data, 0, count, "ISO-8859-1");
-        System.out.println(s);
-        */
+        boolean readall = false; // change this to read only partially
+        String  entity = null;
+        if (readall) {
+            entity = EntityUtils.toString(response.getEntity());
+        } else {
+            byte[] data = new byte[100];
+            int count = response.getEntity().getContent().read(data);
+            entity = new String(data, 0, count, "ISO-8859-1");
+        }
+        System.out.println(entity);
 
         // don't forget this, or the connection remains locked!
         handle.close();