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 2015/12/01 14:14:48 UTC

svn commit: r1717425 - in /httpcomponents/httpcore/trunk/httpcore/src: examples/org/apache/hc/core5/http/examples/ main/java/org/apache/hc/core5/http/ main/java/org/apache/hc/core5/http/entity/ main/java/org/apache/hc/core5/http/nio/entity/

Author: olegk
Date: Tue Dec  1 13:14:48 2015
New Revision: 1717425

URL: http://svn.apache.org/viewvc?rev=1717425&view=rev
Log:
Updated examples to use StandardCharsets

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/hc/core5/http/examples/ElementalHttpPost.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/Consts.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/entity/StringEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/nio/entity/NStringEntity.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/hc/core5/http/examples/ElementalHttpPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/hc/core5/http/examples/ElementalHttpPost.java?rev=1717425&r1=1717424&r2=1717425&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/hc/core5/http/examples/ElementalHttpPost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/hc/core5/http/examples/ElementalHttpPost.java Tue Dec  1 13:14:48 2015
@@ -29,9 +29,9 @@ package org.apache.hc.core5.http.example
 
 import java.io.ByteArrayInputStream;
 import java.net.Socket;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
@@ -81,14 +81,14 @@ public class ElementalHttpPost {
             HttpEntity[] requestBodies = {
                     new StringEntity(
                             "This is the first test request",
-                            ContentType.create("text/plain", Consts.UTF_8)),
+                            ContentType.create("text/plain", StandardCharsets.UTF_8)),
                     new ByteArrayEntity(
-                            "This is the second test request".getBytes(Consts.UTF_8),
+                            "This is the second test request".getBytes(StandardCharsets.UTF_8),
                             ContentType.APPLICATION_OCTET_STREAM),
                     new InputStreamEntity(
                             new ByteArrayInputStream(
                                     "This is the third test request (will be chunked)"
-                                    .getBytes(Consts.UTF_8)),
+                                    .getBytes(StandardCharsets.UTF_8)),
                             ContentType.APPLICATION_OCTET_STREAM)
             };
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/Consts.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/Consts.java?rev=1717425&r1=1717424&r2=1717425&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/Consts.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/Consts.java Tue Dec  1 13:14:48 2015
@@ -27,13 +27,11 @@
 
 package org.apache.hc.core5.http;
 
-import java.nio.charset.StandardCharsets;
-
 /**
  * Commons constants.
  *
  * @since 4.2
- * @since 5.0 Removed Charset constants, reuse Java 7's {@link StandardCharsets} class instead.
+ * @since 5.0 Removed Charset constants, reuse Java 7's {@link java.nio.charset.StandardCharsets} class instead.
  */
 public final class Consts {
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/entity/StringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/entity/StringEntity.java?rev=1717425&r1=1717424&r2=1717425&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/entity/StringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/entity/StringEntity.java Tue Dec  1 13:14:48 2015
@@ -78,7 +78,7 @@ public class StringEntity extends Abstra
      *
      * @param string content to be used. Not {@code null}.
      * @param charset character set to be used. May be {@code null}, in which case the default
-     *   is {@link org.apache.hc.core5.http.Consts#ISO_8859_1} is assumed
+     *   is {@link StandardCharsets#ISO_8859_1} is assumed
      *
      * @throws IllegalArgumentException if the string parameter is null
      *

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/nio/entity/NStringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/nio/entity/NStringEntity.java?rev=1717425&r1=1717424&r2=1717425&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/nio/entity/NStringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/nio/entity/NStringEntity.java Tue Dec  1 13:14:48 2015
@@ -86,7 +86,7 @@ public class NStringEntity extends Abstr
      *
      * @param s content to be used. Not {@code null}.
      * @param charset character set to be used. May be {@code null}, in which case the default
-     *   is {@link org.apache.hc.core5.http.Consts#ISO_8859_1} is assumed
+     *   is {@link StandardCharsets#ISO_8859_1} is assumed
      *
      * @throws IllegalArgumentException if the string parameter is null
      *