title: Java URL download returns meta refresh tag instead of content
body: <p>I have an URL of a file - for example:</p>
  
  <pre><code>Http://www.anyUrl.com/fileExample
  </code></pre>
  
  <p>which is offering to download this file when pasting it in Chrome/Explorer</p>
  
  <p>I want to get this file using Java code.</p>
  
  <p>Tried doing it using:</p>
  
  <pre><code>URL url = new URL("https://www.....");  InputStream......
  or
  DataInputStream ;
  or
  file = new File("https://www.....");
  </code></pre>
  
  <p>as well as this <a href="https://stackoverflow.com/questions/2166039/java-how-to-get-a-file-from-an-escaped-url">link</a>.</p>
  
  <p>None of them works for me.</p>
  
  <p>All I got was something that looks like this: </p>
  
  <pre><code>&lt;/script&gt;&lt;noscript&gt;&lt;META http-equiv="refresh" content="0
  </code></pre>
  
  <p>which is not the content of the given file.</p>
  
  <p>How can it be done in Java?</p>