ִ��post���� @param url ����URL��ַ @param headers ����ͷ @param jsonParams ����JSON��ʽ�ַ������� @return HTTP��Ӧ���� @throws IOException �����쳣ʱ�׳����ɵ����ߴ���
(String url, Map<String, String> headers, String jsonParams)
| 171 | * @throws IOException �����쳣ʱ�׳����ɵ����ߴ��� |
| 172 | */ |
| 173 | private static Response doPostRequest(String url, Map<String, String> headers, String jsonParams) throws IOException { |
| 174 | if (null == url || url.isEmpty()) { |
| 175 | throw new RuntimeException("The request URL is blank."); |
| 176 | } |
| 177 | |
| 178 | // �����Https���� |
| 179 | if (url.startsWith(HTTPS)) { |
| 180 | getTrust(); |
| 181 | } |
| 182 | // System.out.println(url); |
| 183 | Connection connection = Jsoup.connect(url); |
| 184 | connection.method(Method.POST); |
| 185 | connection.timeout(TIME_OUT); |
| 186 | connection.ignoreHttpErrors(true); |
| 187 | connection.ignoreContentType(true); |
| 188 | connection.maxBodySize(0); |
| 189 | |
| 190 | if (null != headers) { |
| 191 | connection.headers(headers); |
| 192 | } |
| 193 | |
| 194 | connection.header(CONTENT_TYPE, JSON_TYPE); |
| 195 | connection.requestBody(jsonParams); |
| 196 | |
| 197 | Response response = connection.execute(); |
| 198 | return response; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * ��ͨ����ʽ����POST���� |
no test coverage detected