如何解决HttpURLConnection.setFollowRedirectstrue不起作用
我的代码:
HttpURLConnection.setFollowRedirects(true);
HttpsURLConnection.setFollowRedirects(true);
但我也收到了http302临时移动
URL:http://bmclapi2.bangbang93.com/mc/game/version_manifest.json
为什么?
其他代码:
HttpURLConnection connection = (HttpURLConnection) from.openConnection();
connection.setInstanceFollowRedirects(true);
// Set GZIP and load ETag
// Try make the connection,it will hang here if the connection is bad
connection.connect();
int code = connection.getResponseCode();
if ((code < 200 || code > 299) && code != HttpURLConnection.HTTP_NOT_MODIFIED) {
//Didn't get what we expected
throw new IOException(connection.getResponseMessage() + " for " + from); // Throw on this line
}
long modifyTime = connection.getHeaderFieldDate("Last-Modified",-1);
......Other codes
我的英语不是很好,请帮助我
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。