/**
* 根据url获取输入流(POST),https,利用HttpClient
*
* @param url
* @param content
* @param accessToken
* @return
* @throws IOException
* @throws NoSuchProviderException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
*/
public static InputStream getHttpsInputStreamByHttpClient(String url, String content)
throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
String action = url;
CloseableHttpClient httpclient = HttpClients.custom().build();
HttpPost httpPost=new HttpPost(url);
StringEntity stringEntity=new StringEntity(content.toString(),"utf-8"); //这里设置发送内容的编码格式
httpPost.setEntity(stringEntity);
CloseableHttpResponse response = httpclient.execute(httpPost);
HttpEntity entity = response.getEntity();
return entity.getContent();
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- hzar.cn 版权所有 赣ICP备2024042791号-5
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务