Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.io.IOException: Server returns HTTP response code 505

Tags:

People also ask

How to resolve HTTP 505 error in java?

If you come across a 505 error on your site, the first thing you want to do is update your web browser. If you're using an older version, update to a newer version or switch to a modern browser. If the error goes away, congrats, you've done it!

What does the HTTP response code 505 mean?

The HyperText Transfer Protocol (HTTP) 505 HTTP Version Not Supported response status code indicates that the HTTP version used in the request is not supported by the server.


I have HTML based queries in my code and one specific kind seems to give rise to IOExceptions upon receiving 505 response from the server. I have looked up the 505 response along with other people who seemed to have similar problems. Apparently 505 stands for HTTP version mismatch, but when I copy the same query URL to any browser (tried firefox, seamonkey and Opera) there seems to be no problem. One of the posts I read suggested that the browsers might automatically handle the version mismatch problem..

I have tried to dig in deeper by using the nice developer tool that comes with Opera, and it looks like there is no mismatch in versions (I believe Java uses HTTP 1.1) and a nice 200 OK response is received. Why do I experience problems when the same query goes through my Java code?

     private InputStream openURL(String urlName) throws IOException{         URL url = new URL(urlName);     URLConnection urlConnection = url.openConnection();     return urlConnection.getInputStream();  } 

sample link: http://www.uniprot.org/uniprot/?query=mnemonic%3aNUGM_HUMAN&format=tab&columns=id,entry%20name,reviewed,organism,length