I am writing a REST client for CouchDB in Java. The following code should be quite standard:
this.httpCnt.connect();
Map respon
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.
See this question:
"The HttpURLConnection.getErrorStream method will return an InputStream which can be used to retrieve data from error conditions (such as a 404), according to the javadocs."