I'm using jsoup to connect a url
the url redirects to another one by 302
I want to get the main url (second one after redirection)
Here is the code:
Connection.Response response = Jsoup
.connect(f_url[0])
.method(Connection.Method.GET)
.followRedirects(false)
.header("Accept", "image/png,image/*;q=0.8,*/*;q=0.5")
.header("Accept-Encoding", "gzip, deflate")
.header("Accept-Language", "en-US,en;q=0.5")
.header("Connection", "keep-alive")
.userAgent("Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0")
.timeout(globalData.WEB_TIME_OUT).execute();
String the_url = response.header("Location");
The problem : I get ioexception I'm sure the url is correct its a file for download i have tested it.it redirects to main address and the file starts to download
java.io.IOException: 400 error loading URL
followRedirects
totrue
change anything? – Ken Wolf Jun 10 '13 at 12:29