From aa3280a47374e4ff7d58f92c18c11496102bae6e Mon Sep 17 00:00:00 2001 From: ky <592468495@qq.com> Date: Wed, 15 Jul 2020 18:11:14 +0800 Subject: [PATCH] p --- pom.xml | 12 ++--- src/main/java/com/yhjd/util/OkHttpUtils.java | 45 ------------------- .../java/com/yhjd/util/QuietCloseUtils.java | 38 ---------------- 3 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 src/main/java/com/yhjd/util/OkHttpUtils.java delete mode 100644 src/main/java/com/yhjd/util/QuietCloseUtils.java diff --git a/pom.xml b/pom.xml index 95e1252..15552da 100755 --- a/pom.xml +++ b/pom.xml @@ -119,12 +119,12 @@ log4j 1.2.17 - - - com.squareup.okhttp3 - okhttp - 3.9.1 - + + + + + + com.predic8 diff --git a/src/main/java/com/yhjd/util/OkHttpUtils.java b/src/main/java/com/yhjd/util/OkHttpUtils.java deleted file mode 100644 index 49b0204..0000000 --- a/src/main/java/com/yhjd/util/OkHttpUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.yhjd.util; - -import com.alibaba.fastjson.JSONObject; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; - -import java.io.IOException; - -public class OkHttpUtils { - - public static JSONObject response(OkHttpClient client, Request request){ - // 4 执行请求操作 - try { - Response response = client.newCall(request).execute(); - - System.out.println(response); - if (response.isSuccessful()) { - String string = response.body().string(); - System.out.println("返回内容"+string); - JSONObject result = JSONObject.parseObject(string); - return result; - } - return null; - } catch (IOException e) { - throw new RuntimeException("请求微服务失败",e); - } - } - - public static String stringResponse(OkHttpClient client, Request request){ - // 4 执行请求操作 - try { - Response response = client.newCall(request).execute(); - - System.out.println(response); - if (response.isSuccessful()) { - String string = response.body().string(); - return string; - } - return null; - } catch (IOException e) { - throw new RuntimeException("请求微服务失败",e); - } - } -} diff --git a/src/main/java/com/yhjd/util/QuietCloseUtils.java b/src/main/java/com/yhjd/util/QuietCloseUtils.java deleted file mode 100644 index 56df56e..0000000 --- a/src/main/java/com/yhjd/util/QuietCloseUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.yhjd.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - *

- * Title : - *

- *

- * Description: - *

- *

- * Author :蔡雨生 - *

- *

- * Department : 研发部 - *

- *

Copyright : ©协群(上海)网络科技有限公司

- */ -public class QuietCloseUtils { - - private static final Logger logger = LoggerFactory.getLogger(QuietCloseUtils.class); - - private QuietCloseUtils() { - } - - public static void close(AutoCloseable s) { - if(s != null) { - try { - s.close(); - s = null; - } catch (Exception var2) { - logger.error("关闭失败", var2); - } - } - } -}