Tag: http status code 505

java.io.IOException:服务器返回HTTP响应代码505

我在我的代码中有基于HTML的查询,一个特定的类似乎在从服务器收到505响应时引起IOExceptions 。 我和其他似乎有类似问题的人一起查看了505的反应。 显然505表示HTTP版本不匹配,但是当我将相同的查询URL复制到任何浏览器(尝试过firefox,seamonkey和Opera)时,似乎没有问题。 我读过的其中一篇post表明浏览器可能会自动处理版本不匹配问题。 我试图通过使用Opera附带的漂亮的开发人员工具深入挖掘,看起来版本中没有不匹配(我相信Java使用HTTP 1.1)并且收到了一个不错的200 OK响应。 当同一查询通过我的Java代码时,为什么会遇到问题? private InputStream openURL(String urlName) throws IOException{ URL url = new URL(urlName); URLConnection urlConnection = url.openConnection(); return urlConnection.getInputStream(); } 示例链接: http://www.uniprot.org/uniprot/?query=mnemonic%3aNUGM_HUMAN&format=tab&columns=id,entry%20name,reviewed,organism,length : http://www.uniprot.org/uniprot/?query=mnemonic%3aNUGM_HUMAN&format=tab&columns=id,entry%20name,reviewed,organism,length mysmonic%3AaNUGM_HUMAN& http://www.uniprot.org/uniprot/?query=mnemonic%3aNUGM_HUMAN&format=tab&columns=id,entry%20name,reviewed,organism,length tab&column = http://www.uniprot.org/uniprot/?query=mnemonic%3aNUGM_HUMAN&format=tab&columns=id,entry%20name,reviewed,organism,length