hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1049368 - /httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml
Date Wed, 15 Dec 2010 00:45:25 GMT
Author: sebb
Date: Wed Dec 15 00:45:25 2010
New Revision: 1049368

URL: http://svn.apache.org/viewvc?rev=1049368&view=rev
Log:
StringEntity now has 3 ctors

Modified:
    httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml

Modified: httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml?rev=1049368&r1=1049367&r2=1049368&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml (original)
+++ httpcomponents/httpcore/trunk/src/docbkx/fundamentals.xml Wed Dec 15 00:45:25 2010
@@ -440,9 +440,9 @@ ByteArrayEntity myEntity = new ByteArray
                 <para>
                 <classname>StringEntity</classname> is a self contained, repeatable
entity that 
                 obtains its content from a <classname>java.lang.String</classname>
object. It has 
-                two constructors, one simply constructs with a given <classname>java.lang.String
-                </classname> object; the other also takes a character encoding for
the data in the 
-                string.
+                three constructors, one simply constructs with a given <classname>java.lang.String
+                </classname> object; the second also takes a character encoding for
the data in the 
+                string; the third allows the mime type to be specified.
                 </para>
                 <programlisting><![CDATA[
 StringBuffer sb = new StringBuffer();
@@ -452,11 +452,14 @@ for (Entry<String, String> envEntry : en
     .append(envEntry.getValue()).append("\n");
 }
 
-// construct without a character encoding
+// construct without a character encoding (defaults to ISO-8859-1)
 HttpEntity myEntity1 = new StringEntity(sb.toString());
 
-// alternatively construct with an encoding
+// alternatively construct with an encoding (mime type defaults to "text/plain")
 HttpEntity myEntity2 = new StringEntity(sb.toString(), "UTF-8");
+
+// alternatively construct with an encoding and a mime type
+HttpEntity myEntity3 = new StringEntity(sb.toString(), "text/html", "UTF-8");
 ]]></programlisting>
             </section>
             <section id="input-stream-entity">



Mime
View raw message