You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/09/18 16:27:05 UTC

svn commit: r1172290 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java src/site/apt/examples.apt

Author: olegk
Date: Sun Sep 18 14:27:05 2011
New Revision: 1172290

URL: http://svn.apache.org/viewvc?rev=1172290&view=rev
Log:
Updated HttpCore examples page

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/src/site/apt/examples.apt

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=1172290&r1=1172289&r2=1172290&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java Sun Sep 18 14:27:05 2011
@@ -38,6 +38,7 @@ import org.apache.http.impl.DefaultConne
 import org.apache.http.impl.nio.DefaultClientIODispatch;
 import org.apache.http.impl.nio.pool.BasicNIOConnPool;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.nio.protocol.BasicAsyncRequestProducer;
 import org.apache.http.nio.protocol.BasicAsyncResponseConsumer;
@@ -85,7 +86,9 @@ public class NHttpClient {
         // Create client-side I/O event dispatch
         final IOEventDispatch ioEventDispatch = new DefaultClientIODispatch(protocolHandler, params);
         // Create client-side I/O reactor
-        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
+        IOReactorConfig config = new IOReactorConfig();
+        config.setIoThreadCount(1);
+        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(config);
         // Create HTTP connection pool
         BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, params);
         // Limit total number of connections to just two

Modified: httpcomponents/httpcore/trunk/src/site/apt/examples.apt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/src/site/apt/examples.apt?rev=1172290&r1=1172289&r2=1172290&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/src/site/apt/examples.apt (original)
+++ httpcomponents/httpcore/trunk/src/site/apt/examples.apt Sun Sep 18 14:27:05 2011
@@ -30,34 +30,33 @@
 
 HttpCore Examples
 
-    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpGet.java}Basic HTTP GET}}
+    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpGet.java} Basic HTTP GET}}
     
-    This example demonstrates how to execute a series of simple HTTP GET requests.
+    This example demonstrates how to execute a series of synchronous (blocking) HTTP GET requests.
 
-    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpPost.java}Basic HTTP POST}}
+    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpPost.java} Basic HTTP POST}}
     
-    This example demonstrates how to execute a series of simple HTTP POST requests that enclose entity 
-    content of various types: a string, a byte array, an arbitrary input stream.  
+    This example demonstrates how to execute a series of synchronous (blocking) HTTP POST requests 
+    that enclose entity content of various types: a string, a byte array, an arbitrary input stream.  
 
-    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpServer.java}Basic HTTP server}}
+    * {{{./httpcore/examples/org/apache/http/examples/ElementalHttpServer.java} Basic HTTP server}}
     
-    This is an example of a simple but fully functional HTTP/1.1 server written with only a few dozen 
-    lines of Java code.
+    This is an example of an HTTP/1.1 file server based on a synchronous (blocking) I/O model.
 
-    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpServer.java}Basic non-blocking HTTP server}}
+    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpClient.java} Asynchronous HTTP GET}}
     
-    This example demonstrates the use of HttpCore NIO extensions to build a non-blocking HTTP/1.1 server.
+    This example demonstrates how HttpCore NIO can be used to execute multiple HTTP GET requests 
+    asynchronously using only one I/O thread.
 
-    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpClient.java}Basic non-blocking HTTP client}}
+    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpServer.java} Asynchronous HTTP 
+    server}}
     
-    This example demonstrates how HttpCore NIO can be used to execute multiple HTTP requests using
-    only one I/O thread.
+    This example demonstrates the use of HttpCore NIO to build an asynchronous (non-blocking) 
+    HTTP server capable of direct channel (zero copy) data transfer.
 
-    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpClientConnManagement.java}Management of non-blocking client connections}}
+    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpReverseProxy.java} Asynchronous 
+    HTTP reverse proxy}}
     
-    This example demonstrates how to manage reuse of persistent client connections using HttpCore NIO. 
-
-    * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpSSLServer.java}Basic non-blocking HTTPS server}}
-    
-    This example demonstrates the use of HttpCore NIO extensions to build a non-blocking HTTPS/1.1 server.
-
+    This example demonstrates how HttpCore NIO can be used to build an asynchronous, fully
+    streaming reverse HTTP proxy.
+