urlSuffix = url.substring(server.length());
LOGGER.info("redirected to server: "+server);
try {
_targetServer.setNewTargetServer(new Server(new URL(server)));
} catch (MalformedURLException e1) {
throw new ServiceNotAvailableException("redirected to malformed url: "+server, e1);
}
} catch(ConnectException e) {
LOGGER.info("Server did not respond: "+serverUrl, e);
if (firstException == null) {
firstException = e;
}
errorMessages.append("[").append(serverUrl).append(": ").append(e.getClass().getName()).append(" ").append(e.getMessage()).append("] ");
} catch (NoHttpResponseException e) { //idem ConnectException but thru proxy
LOGGER.info("Server did not respond correctly: "+serverUrl, e);
if (firstException == null) {
firstException = e;
}
errorMessages.append("[").append(serverUrl).append(": ").append(e.getClass().getName()).append(" ").append(e.getMessage()).append("] ");
} catch (IOException e) {
LOGGER.info("Unable to connect to: "+serverUrl, e);
if (firstException == null) {
firstException = e;
}
errorMessages.append("[").append(serverUrl).append(": ").append(e.getClass().getName()).append(" ").append(e.getMessage()).append("] ");
}
}
if (firstException != null) {
throw new ServiceNotAvailableException(errorMessages.toString(), firstException);
} else {
throw new ServiceNotAvailableException("Server did not respond: "+_targetServer);
}
}