Hi,
I'm trying use pre-emptive HTTP basic authentication with Jersey
1.17.1 and Apache HttpClient.
HTTP basic auth headers do not seem get added in the HTTP request.
Is this the way credentials should be set for pre-emptive authentication?
Here's the code I'm using:
URL svcUrl = new URL("
http://localhost:8080/foo/bar");
String userName = "foo";
String password = "bar";
ApacheHttpClientConfig acc = new DefaultApacheHttpClientConfig();
acc.getProperties().put(ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION,
Boolean.TRUE);
ApacheHttpClientState st = acc.getState();
st.setCredentials(null, svcUrl.getHost(), svcUrl.getPort(), userName, password);
ApacheHttpClient hc = ApacheHttpClient.create(acc);
marko