M
Muggle
Hello everyone,
I have a url http://www.xyz.com and in the browser it gets redirected
to http://www.xyz.com/page_id=123.
Using java, how can I start from www.xyz.com and find out the
redirected url ? (www.xyz.com/page_id=123 in this case) ?
I started in the following way, but could not get there. The response
code even for a redirecting URL is 200. Why is that?
.....
String urlString = "http://www.ft.com";
URL url = new URL(urlString);
HttpURLConnection httpURLConnection = (HttpURLConnection)
url.openConnection();
httpURLConnection.setInstanceFollowRedirects(true);
System.out.println("Response Code " +
httpURLConnection.getResponseCode());
Thank you
Muggle
I have a url http://www.xyz.com and in the browser it gets redirected
to http://www.xyz.com/page_id=123.
Using java, how can I start from www.xyz.com and find out the
redirected url ? (www.xyz.com/page_id=123 in this case) ?
I started in the following way, but could not get there. The response
code even for a redirecting URL is 200. Why is that?
.....
String urlString = "http://www.ft.com";
URL url = new URL(urlString);
HttpURLConnection httpURLConnection = (HttpURLConnection)
url.openConnection();
httpURLConnection.setInstanceFollowRedirects(true);
System.out.println("Response Code " +
httpURLConnection.getResponseCode());
Thank you
Muggle