java hostnameverifier_android httpclients 报 java.lang.VerifyError: org/apache/http/conn/ssl/DefaultH...
List params = new LinkedList();params.add(new BasicNameValuePair("ajax", "1"));String param = URLEncodedUtils.format(params, "UTF-8");String baseUrl = "http://www.xxx.com";Log.v("url", baseUrl+"?"+par
List params = new LinkedList();
params.add(new BasicNameValuePair("ajax", "1"));
String param = URLEncodedUtils.format(params, "UTF-8");
String baseUrl = "http://www.xxx.com";
Log.v("url", baseUrl+"?"+param);
HttpGet httpGet = new HttpGet(baseUrl+"?"+param);
CloseableHttpClient httpClient = HttpClients.createDefault();
try {
CloseableHttpResponse response = httpClient.execute(httpGet);
HttpEntity httpEntity = response.getEntity();
TextView codeValueTV =(TextView) findViewById(R.id.codeValue);
codeValueTV.setText(response.getStatusLine()+"");
TextView contentTV =(TextView) findViewById(R.id.content);
contentTV.setText(EntityUtils.toString(httpEntity));
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
上面是代码详情。
更多推荐
所有评论(0)