| | |
| | | |
| | | private static final CloseableHttpClient httpclient = HttpClients.createDefault(); |
| | | |
| | | public static String doGet(String urlPath, Map<String, Object> params) |
| | | public static String doGet(String urlPath, Map<String, Object> params,String token) |
| | | throws Exception { |
| | | StringBuilder sb = new StringBuilder(urlPath); |
| | | if (params != null && !params.isEmpty()) { // 说明有参数 |
| | |
| | | |
| | | URL url = new URL(sb.toString()); |
| | | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setRequestProperty("auth", token); |
| | | conn.setConnectTimeout(5000); // 5s超时 |
| | | conn.setRequestMethod("GET"); |
| | | |