diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index 713d295..42d69e2 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.5.1"; + public static final String version="1.5.2"; public static void main(String[] args) { System.out.println("当前版本号:" + version); diff --git a/src/main/java/com/yutou/tools/utils/HttpTools.java b/src/main/java/com/yutou/tools/utils/HttpTools.java index 969abf3..2b377ad 100644 --- a/src/main/java/com/yutou/tools/utils/HttpTools.java +++ b/src/main/java/com/yutou/tools/utils/HttpTools.java @@ -18,9 +18,19 @@ public class HttpTools { private static final int HttpRequestIndex = 3; public static String get(String url) { - return https_get(url, null); + if(url.startsWith("http:")){ + return https_get(HttpURLConnection.class, url, null); + }else { + return https_get(HttpsURLConnection.class,url, null); + } + } + public static String https_get(String url, Map header) { + if(url.startsWith("http:")){ + return https_get(HttpURLConnection.class, url, header); + }else { + return https_get(HttpsURLConnection.class,url, header); + } } - public static String post(final String url, final byte[] body) { return http_post(url, body, 0, null); } @@ -29,10 +39,9 @@ public class HttpTools { return new HttpTools().http_syncDownload(url, saveName); } - public static String https_get(String url, Map header) { + public static String https_get(Class c, String url, Map header) { try { - URLConnection connection; - connection = new URL(url).openConnection(); + T connection = (T) new URL(url).openConnection(); connection.setConnectTimeout(60*1000); connection.setReadTimeout(60*1000); connection.setRequestProperty("User-Agent", getExtUa()); diff --git a/src/main/java/com/yutou/tools/utils/Tools.java b/src/main/java/com/yutou/tools/utils/Tools.java index 82bec8d..0a7863d 100644 --- a/src/main/java/com/yutou/tools/utils/Tools.java +++ b/src/main/java/com/yutou/tools/utils/Tools.java @@ -3,6 +3,9 @@ package com.yutou.tools.utils; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.interfaces.DownloadInterface; +import com.yutou.tools.mybatis.dao.ToolsPasswordDao; +import com.yutou.tools.mybatis.model.ToolsPassword; +import com.yutou.tools.mybatis.model.ToolsPasswordExample; import com.yutou.tools.nas.UpdateIp; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.beans.factory.config.BeanDefinition; @@ -490,6 +493,6 @@ public class Tools { } public static void main(String[] args) { - System.out.println(getPinYin("你好")); + System.out.println(getPinYin("webdav")); } }