throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
}
}
private void setupAuthentication(URI link, HttpClient client, GetMethod getMethod) throws URIException, CredentialsException {
ICredentials authCredentials = Owl.getConnectionService().getAuthCredentials(link);
if (authCredentials != null) {
client.getParams().setAuthenticationPreemptive(true);
/* Require Host */
String host = getMethod.getURI().getHost();
/* Create the UsernamePasswordCredentials */
NTCredentials userPwCreds = new NTCredentials(authCredentials.getUsername(), authCredentials.getPassword(), host, (authCredentials.getDomain() != null) ? authCredentials.getDomain() : ""); //$NON-NLS-1$
/* Authenticate to the Server */
client.getState().setCredentials(AuthScope.ANY, userPwCreds);
getMethod.setDoAuthentication(true);
}