java - Create SWT browser exception -
how create exception seturl() method swt browser ? want show url wrong or problem connectivity.
it seems want check if given url available/reachable. in case, code want:
private static boolean isreachable(string url) { try { httpurlconnection connection = (httpurlconnection) new url(url).openconnection(); connection.setrequestmethod("head"); int responsecode = connection.getresponsecode(); return responsecode == 200; } catch (ioexception e) { return false; } } just call before call browser#seturl().
Comments
Post a Comment