| | |
| | | import java.net.SocketTimeoutException;
|
| | | import java.net.URL;
|
| | | import java.net.URLConnection;
|
| | | import java.nio.charset.StandardCharsets;
|
| | | import java.security.cert.X509Certificate;
|
| | | import javax.net.ssl.HostnameVerifier;
|
| | | import javax.net.ssl.HttpsURLConnection;
|
| | |
| | | StringBuilder result = new StringBuilder();
|
| | | try
|
| | | {
|
| | | String urlNameString = url;
|
| | | log.info("sendPost - {}", urlNameString);
|
| | | URL realUrl = new URL(urlNameString);
|
| | | log.info("sendPost - {}", url);
|
| | | URL realUrl = new URL(url);
|
| | | URLConnection conn = realUrl.openConnection();
|
| | | conn.setRequestProperty("accept", "*/*");
|
| | | conn.setRequestProperty("connection", "Keep-Alive");
|
| | |
| | | out = new PrintWriter(conn.getOutputStream());
|
| | | out.print(param);
|
| | | out.flush();
|
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
| | | String line;
|
| | | while ((line = in.readLine()) != null)
|
| | | {
|
| | |
| | | {
|
| | | if (ret != null && !"".equals(ret.trim()))
|
| | | {
|
| | | result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
|
| | | result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
|
| | | }
|
| | | }
|
| | | log.info("recv - {}", result);
|