如何检索代码为300的HTTP响应正文中提供的多个URL?

时间:2014-01-27 17:33:44

标签: java httpurlconnection http-redirect

我有以下Java代码:

HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();
connection.setRequestProperty("User-Agent","");
connection.setInstanceFollowRedirects(true);
int responseCode = connection.getResponseCode();

当响应代码为300时,如何提取响应正文中提供的URL?

由于

0 个答案:

没有答案