throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
}
}
private void setupAuthentication(URI link, String realm, HttpClient client, HttpMethodBase method) throws URIException, CredentialsException {
ICredentials authCredentials = Owl.getConnectionService().getAuthCredentials(link, realm);
if (authCredentials != null) {
client.getParams().setAuthenticationPreemptive(true);
/* Require Host */
String host = method.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);
method.setDoAuthentication(true);
}