| 46 | } |
| 47 | |
| 48 | public static Response get(String url, HashMap<String, ?> headers, String encoding) { |
| 49 | Response response = new Response(0, (String)null, (String)null, (String)null); |
| 50 | |
| 51 | try { |
| 52 | HttpURLConnection conn = getCoon(url); |
| 53 | conn.setRequestMethod("GET"); |
| 54 | Iterator var4 = headers.keySet().iterator(); |
| 55 | |
| 56 | while(var4.hasNext()) { |
| 57 | String key = (String)var4.next(); |
| 58 | conn.setRequestProperty(key, (String)headers.get(key)); |
| 59 | } |
| 60 | |
| 61 | response = getResponse(conn, encoding); |
| 62 | } catch (SocketTimeoutException var6) { |
| 63 | response.setError("连接超时!"); |
| 64 | } catch (IOException var7) { |
| 65 | LOGGER.debug(var7.getMessage()); |
| 66 | response.setError(var7.getMessage()); |
| 67 | } catch (KeyManagementException | NoSuchProviderException | NoSuchAlgorithmException var8) { |
| 68 | response.setError(var8.getMessage()); |
| 69 | } |
| 70 | return response; |
| 71 | } |
| 72 | |
| 73 | // public static Response post(String url, String postString, HashMap<String, ?> headers, String encoding) { |
| 74 | // Response response = new Response(0, (String)null, (String)null, (String)null); |