// set preemptive authentication
if ((authType.equals(AuthType.GLOBAL_HTTP_SETTINGS) && settings.getBoolean(HttpSettings.AUTHENTICATE_PREEMPTIVELY))
|| authType.equals(AuthType.PREEMPTIVE)) {
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(username, password);
Header header = BasicScheme.authenticate(creds, "utf-8", false);
httpMethod.removeHeaders("Authorization");
httpMethod.addHeader(header);
}
}
httpContext.setAttribute(ClientContext.CREDS_PROVIDER, new UPDCredentialsProvider(username, password, domain));