/*
* HttpClient Post提交 不带参数
*/
@Test
public void fun3() throws ClientProtocolException, IOException{
//1、创建HttpClient
CloseableHttpClient clients = HttpClients.createDefault();
//2、创建HttpPost
HttpPost post = new HttpPost("http://localhost:8080/itcast297/loginAction_login");
//3、执行请求
CloseableHttpResponse response = clients.execute(post);
//4获取实体
HttpEntity entity = response.getEntity();
//将实体转换成字符串
System.out.println(EntityUtils.toString(entity));
response.close();
}
HttpClient Post提交 不带参数
最新推荐文章于 2024-05-11 13:02:29 发布