//从输入流读取返回内容
InputStream is = null;
int status = connection.getResponseCode();
if(status>= HttpStatus.SC_BAD_REQUEST){ //此处一定要根据返回的状态码state来初始化输入流。如果为错误
is = connection.getErrorStream();
}else{
//如果正确
is = connection.getInputStream();
}
//从输入流读取返回内容
InputStream is = null;
int status = connection.getResponseCode();
if(status>= HttpStatus.SC_BAD_REQUEST){ //此处一定要根据返回的状态码state来初始化输入流。如果为错误
is = connection.getErrorStream();
}else{
//如果正确
is = connection.getInputStream();
}
关于HttpURLConnection/HttpsURLConnection请求出现了io.filenotfoundexception:url的解决方法
原文:https://www.cnblogs.com/xiangxinhouse/p/8366931.html