Read error response body in Java

后端 未结 8 1429
暗喜
暗喜 2020-11-28 05:32

In Java, this code throws an exception when the HTTP result is 404 range:

URL url = new URL(\"http://stackoverflow.com/asdf404notfound\");
HttpURLConnection          


        
8条回答
  •  野性不改
    2020-11-28 06:23

    First check the response code and then use HttpURLConnection.getErrorStream()

提交回复
热议问题