12-25-2010 08:56 PM
12-27-2010 03:42 AM
public boolean isAlfrescoReachable(String url) {
if (url == null || url.isEmpty()) throw new IllegalArgumentException("Url must not be null or empty.");
try {
URL url = new URL(url); // Url to alfresco app example. http://localhost:8080/alfresco
HttpURLConnection urlConnect = (HttpURLConnection) url.openConnection();
urlConnect.setConnectTimeout(10000);
urlConnect.setReadTimeout(15000);
int responseCode = urlConnect.getResponseCode();
log.debug("Alfresco response code " + responseCode);
if (responseCode != HttpURLConnection.HTTP_OK) {
// Everyting ok
return true;
} else {
// Depends on status code but probably ok
}
} catch (UnknownHostException e) {
log.debug(e, e);
return false;
} catch (IOException e) {
log.debug(e, e);
return false;
}
return true;
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.