If i create a URL with the address of a page that automatically redirects somewhere else the operation URL.openConnection().getcontent() returns the content of the page after redirection, but i can find no way of getting the URL of the page that the first URL redirects to. can anyone help me? Thanks in advance and if any more information is needed please ask.
example code with which to recreate the problem:
URL url = new URL("http://www.google.co.uk/search?hl=en&q=nested+Tables&btnI=I%27m+Feeling+Lucky&meta=");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
System.out.println(conn.getURL); /*prints out the first url rather than the url that the first url redirects to*/