| | |
| | | |
| | | import java.io.OutputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.SocketTimeoutException; |
| | | import java.net.URL; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | public class HttpHzUtil { |
| | | |
| | | /**请求方法*/ |
| | | /** |
| | | * 请求方法 |
| | | */ |
| | | public static final String METHOD_POST = "POST"; |
| | | /**编码*/ |
| | | /** |
| | | * 编码 |
| | | */ |
| | | public static final String CHARSET = "UTF-8"; |
| | | |
| | | |
| | | /**请求 |
| | | /** |
| | | * 请求 |
| | | * |
| | | * @param url 请求链接 |
| | | * @param bodyData 请求body数据 |
| | | * @param keyValues 连接携带参数 |
| | |
| | | httpHzResponse.setData(IOUtils.toString(con.getInputStream(), CHARSET)); |
| | | } |
| | | |
| | | }catch (SocketTimeoutException var15) { |
| | | httpHzResponse.setMsg(var15.getMessage()); |
| | | httpHzResponse.setCode(HttpHzResponse.CODE_TIME_OUT); |
| | | var15.printStackTrace(); |
| | | } catch (Exception var14) { |
| | | httpHzResponse.setMsg(var14.getMessage()); |
| | | var14.printStackTrace(); |
| | | } finally { |
| | | if (con != null) { |