|
|
@@ -13,6 +13,7 @@ import org.springframework.web.util.UriComponents;
|
|
|
import org.springframework.web.util.UriComponentsBuilder;
|
|
|
|
|
|
import java.net.URI;
|
|
|
+import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.Charset;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
@@ -35,6 +36,16 @@ public class HttpUtils {
|
|
|
return URLEncoder.encode(value, StandardCharsets.UTF_8);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 解码 URL 参数
|
|
|
+ *
|
|
|
+ * @param value 参数
|
|
|
+ * @return 解码后的参数
|
|
|
+ */
|
|
|
+ public static String decodeUtf8(String value) {
|
|
|
+ return URLDecoder.decode(value, StandardCharsets.UTF_8);
|
|
|
+ }
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public static String replaceUrlQuery(String url, String key, String value) {
|
|
|
UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset());
|