hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1503319 - in /httpcomponents/httpcore/trunk: httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java src/site/apt/examples.apt
Date Mon, 15 Jul 2013 16:07:08 GMT
Author: olegk
Date: Mon Jul 15 16:07:08 2013
New Revision: 1503319

URL: http://svn.apache.org/r1503319
Log:
Tweaked examples slightly

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
    httpcomponents/httpcore/trunk/src/site/apt/examples.apt

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java?rev=1503319&r1=1503318&r2=1503319&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
Mon Jul 15 16:07:08 2013
@@ -31,10 +31,12 @@ import java.io.ByteArrayInputStream;
 import java.net.Socket;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.DefaultBHttpClientConnection;
@@ -77,13 +79,16 @@ public class ElementalHttpPost {
 
             HttpEntity[] requestBodies = {
                     new StringEntity(
-                            "This is the first test request", "UTF-8"),
+                            "This is the first test request",
+                            ContentType.create("text/plain", Consts.UTF_8)),
                     new ByteArrayEntity(
-                            "This is the second test request".getBytes("UTF-8")),
+                            "This is the second test request".getBytes("UTF-8"),
+                            ContentType.APPLICATION_OCTET_STREAM),
                     new InputStreamEntity(
                             new ByteArrayInputStream(
                                     "This is the third test request (will be chunked)"
-                                    .getBytes("UTF-8")), -1)
+                                    .getBytes("UTF-8")),
+                            ContentType.APPLICATION_OCTET_STREAM)
             };
 
             for (int i = 0; i < requestBodies.length; i++) {

Modified: httpcomponents/httpcore/trunk/src/site/apt/examples.apt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/src/site/apt/examples.apt?rev=1503319&r1=1503318&r2=1503319&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/src/site/apt/examples.apt (original)
+++ httpcomponents/httpcore/trunk/src/site/apt/examples.apt Mon Jul 15 16:07:08 2013
@@ -43,6 +43,11 @@ HttpCore Examples
     
     This is an example of an HTTP/1.1 file server based on a synchronous (blocking) I/O model.
 
+    * {{{./httpcore/examples/org/apache/http/examples/ElementalReverseProxy.java} Basic
+    HTTP reverse proxy}}
+
+    This is an example of an HTTP/1.1 reverse proxy based on a synchronous (blocking) I/O
model.
+
     * {{{./httpcore-nio/examples/org/apache/http/examples/nio/NHttpClient.java} Asynchronous
HTTP GET}}
     
     This example demonstrates how HttpCore NIO can be used to execute multiple HTTP requests




Mime
View raw message