From 0524eed4b9272c3e88447f1442db90a85d772b49 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 16 Sep 2020 17:17:44 +0200 Subject: [PATCH] Replaced deprecated URLEncodedUtils --- .../main/java/org/apache/hc/client5/http/fluent/Request.java | 4 ++-- .../apache/hc/client5/http/entity/UrlEncodedFormEntity.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java index b24927d66..492adb7db 100644 --- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java +++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java @@ -60,7 +60,7 @@ import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.io.entity.ByteArrayEntity; import org.apache.hc.core5.http.io.entity.FileEntity; import org.apache.hc.core5.http.io.entity.InputStreamEntity; -import org.apache.hc.core5.net.URLEncodedUtils; +import org.apache.hc.core5.net.WWWFormCodec; import org.apache.hc.core5.util.Timeout; /** @@ -334,7 +334,7 @@ public class Request { } final ContentType contentType = charset != null ? ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED; - final String s = URLEncodedUtils.format(paramList, contentType.getCharset()); + final String s = WWWFormCodec.format(paramList, contentType.getCharset()); return bodyString(s, contentType); } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java index 9e18a775b..156663ade 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java @@ -32,7 +32,7 @@ import java.util.List; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.io.entity.StringEntity; -import org.apache.hc.core5.net.URLEncodedUtils; +import org.apache.hc.core5.net.WWWFormCodec; /** * An entity composed of a list of url-encoded pairs. @@ -54,7 +54,7 @@ public class UrlEncodedFormEntity extends StringEntity { public UrlEncodedFormEntity( final Iterable parameters, final Charset charset) { - super(URLEncodedUtils.format( + super(WWWFormCodec.format( parameters, charset != null ? charset : ContentType.APPLICATION_FORM_URLENCODED.getCharset()), charset != null ? ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED);