private int getResponse(String url) throws Exception {
try {
URL check = new URL(url);
HttpsURLConnection connection = (HttpsURLConnection)check.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5000);
connection.connect();
return(connection.getResponseCode());
} catch (java.net.SocketTimeoutException e) {
return getResponse(url);
}
}
Is there a faster way to get the response code from a URL than HttpsURLConnection?
I tried HeadMethod from the HTTP Client Commons but that's not that much faster.
Thanks in advance