|
|
@@ -3,6 +3,7 @@ package org.jeecg.common.utils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import sun.net.www.protocol.https.Handler;
|
|
|
|
|
|
import javax.net.ssl.*;
|
|
|
import java.io.BufferedReader;
|
|
|
@@ -40,7 +41,8 @@ public class HttpsUtils {
|
|
|
// 从上述SSLContext对象中得到SSLSocketFactory对象
|
|
|
SSLSocketFactory ssf = sslContext.getSocketFactory();
|
|
|
|
|
|
- URL url = new URL(requestUrl);
|
|
|
+ //url是https的时候,使用异常更正
|
|
|
+ URL url = new URL(null, requestUrl, new Handler());
|
|
|
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
|
|
|
httpUrlConn.setSSLSocketFactory(ssf);
|
|
|
|
|
|
@@ -106,7 +108,8 @@ public class HttpsUtils {
|
|
|
// 从上述SSLContext对象中得到SSLSocketFactory对象
|
|
|
SSLSocketFactory ssf = sslContext.getSocketFactory();
|
|
|
|
|
|
- URL url = new URL(requestUrl);
|
|
|
+ //url是https的时候,使用异常更正
|
|
|
+ URL url = new URL(null, requestUrl, new Handler());
|
|
|
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
|
|
|
httpUrlConn.setSSLSocketFactory(ssf);
|
|
|
|