Java HttpURLConnection.getInputStream but get 401 IOException

后端 未结 2 910
有刺的猬
有刺的猬 2020-12-20 19:01

I am writing a REST client for CouchDB in Java. The following code should be quite standard:

    this.httpCnt.connect();
    Map respon         


        
2条回答
  •  长情又很酷
    2020-12-20 19:14

    You need to check for the http status using getResponseCode() to decide if you should use getInputStream() or getErrorStream(). In this case, you need to read the error stream.

提交回复
热议问题