title: Server returned HTTP response code: 400
body: <p>I am trying to get an InputStream from a URL. The URL can be a opened from Firefox. It returns a json and I have installed an addon for viewing json in Firefox so I can view it there.</p>
  
  <p>So I tried to get it from Java by:</p>
  
  <pre><code>URL url = new URL(urlString);
  URLConnection urlConnection = url.openConnection();
  BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
  </code></pre>
  
  <p>But it is throwing an IOException in urlConnection.getInputStream().</p>
  
  <p>I also tried:</p>
  
  <pre><code>HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
  InputStream inputStream = url.openStream();
  </code></pre>
  
  <p>But no luck.</p>
  
  <p>Any information is appreciable. Thanks in advance. </p>