Skip to content

Instantly share code, notes, and snippets.

@bharath2020
Created August 8, 2014 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bharath2020/7287ffe7a0a1225a316d to your computer and use it in GitHub Desktop.
Save bharath2020/7287ffe7a0a1225a316d to your computer and use it in GitHub Desktop.
HTTPUrlConnection redirect once
urlConnection = (HttpURLConnection) imageURL.openConnection();
String location = urlConnection.getHeaderField("Location");
if (location != null )
{
URL newURL = new URL(location);
urlConnection = (HttpURLConnection) newURL.openConnection();
}
//use the urlConnection now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment