发布网友 发布时间:2022-04-22 03:42
共1个回答
热心网友 时间:2024-02-24 12:46
URL
reqUrl
=
new
URL(url);
//
强制类型转换
,也可以转成Http的连接
HttpURLConnection
connection
=
(HttpURLConnection)reqUrl.openConnection();
connection.setRequestProperty("accept",
"*/*");
connection.setRequestProperty("connection",
"Keep-Alive");
HttpClient
是Apache的开源项目中的,请参考官网的例子