|
@@ -17,6 +17,8 @@ import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.dialect.OracleDialect;
|
|
import com.jfinal.plugin.activerecord.dialect.OracleDialect;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
|
|
+import com.zskk.tools.SSLSocketClient;
|
|
|
|
+
|
|
import okhttp3.FormBody;
|
|
import okhttp3.FormBody;
|
|
import okhttp3.MediaType;
|
|
import okhttp3.MediaType;
|
|
import okhttp3.OkHttpClient;
|
|
import okhttp3.OkHttpClient;
|
|
@@ -65,9 +67,16 @@ public class ViewController extends Controller {
|
|
|
|
|
|
}
|
|
}
|
|
public static String postWithParameters(String url, Map<String, String> map) {
|
|
public static String postWithParameters(String url, Map<String, String> map) {
|
|
-
|
|
|
|
- FormBody.Builder formbody = new FormBody.Builder();
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ OkHttpClient client = new OkHttpClient.Builder()
|
|
|
|
+ .sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager())
|
|
|
|
+ .hostnameVerifier(SSLSocketClient.getHostnameVerifier())
|
|
|
|
+ .build();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ FormBody.Builder formbody = new FormBody.Builder();
|
|
|
|
+
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
formbody.add(entry.getKey(), entry.getValue());
|
|
formbody.add(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
@@ -78,7 +87,7 @@ public static String postWithParameters(String url, Map<String, String> map) {
|
|
.post(requestBody)
|
|
.post(requestBody)
|
|
.build();
|
|
.build();
|
|
|
|
|
|
- try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
|
|
|
+ try (Response response = client.newCall(request).execute()) {
|
|
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
|
|
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
|
|
String content = response.body().string();
|
|
String content = response.body().string();
|
|
return content;
|
|
return content;
|