HttpURLConnection.getResponseCode

HttpURLConnection.getResponseCode

Class Overview | Class Members | This Package | All Packages

Syntax
public int getResponseCode() throws IOException
Description
Gets HTTP response status. From responses like:
 HTTP/1.0 200 OK
 HTTP/1.0 401 Unauthorized
 
Extracts the ints 200 and 401 respectively. Returns -1 if none can be discerned from the response (i.e., the response is not valid HTTP).