When I invoke the getInputStream() method in HttpURLConnection, it returns an HTTP exception and I use this strategy to catch that exception.
try {
con.getInputStream();
} catch (IOException e) {
resStream = con.getErrorStream();
}
But, I need to get the useful data sent to resStream by the server as the JavaDoc states as follows. "Returns the error stream if the connection failed but the server sent useful data nonetheless."
Is there any way to get the response message (if the returned value is not null and there is a valid response returned) from the InputStream returned from the getErrorStream()?
resStream
to see if it contains what you expect? – asgs