Make an HTTP request to get a redirect URL?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2659000/java-how-to-find-the-redirected-url-of-a-url">Java - How to find the redirected url of a url?</a>  </p>
</blockquote>



<p>I need to request a URL (URL1). That URL responds with a redirect, to the actual, eventual destination URL (ULRL2). When I use the DefaultHttpClient to make the HTTP call it "helpfully" follows the redirect and delivers the response from URL2, which is not what I want. I want to acquire the URL for URL2, the one being redirected to, without getting its response.</p>

<p>Can I do it with DefaultHttpClient, or is another class required?</p>

<p>==== SOLUTION ========</p>

<pre><code>httpclient.getParams().setBooleanParameter("http.protocol.handle-redirects", false);
</code></pre>
