Answers for "java read from connection even if 404"

0

java read from connection even if 404

HttpURLConnection c = (HttpURLConnection)new URL("http://somesite.com").openConnection();
InputStream in = null;
if (c.getResponseCode() >= 400) {
   in = c.getErrorStream();
}  
else {
   in = c.getInputStream();
}
Posted by: Guest on May-25-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language