Response from UrlConnection Java -
so far, have snippet.
urlconnection connection = null; try { connection = (new url("some_link")).openconnection(); connection.setconnecttimeout(5000); connection.setreadtimeout(5000); connection.connect(); } catch (ioexception e) { } the possible response codes 200 , 404 , it's working fine when response code 200 (ok). question how can find response code received connection, example: if response code 404, throw exception , smth there.
make type of httpurlconnection. can use .getresponsecode();
Comments
Post a Comment