Hey Guys.
I'm using httpclient 4.0.1 to access a basic auth protected Website. But
it works not really...
My source code follows this example:
http://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.0.x/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
===========================
DefaultHttpClient client = new DefaultHttpClient();
UsernamePasswordCredentials creds = new
UsernamePasswordCredentials("username", "password");
client.getCredentialsProvider().setCredentials(new
AuthScope("www.example.com", 80), creds);
BasicHttpContext localcontext = new BasicHttpContext();
BasicScheme basicAuth = new BasicScheme();
localcontext.setAttribute("preemptive-auth", basicAuth);
client.addRequestInterceptor(new PreemptiveAuth(), 0);
HttpGet httpget = new HttpGet("http://www.example.com/dosomething.html");
HttpResponse response = client.execute(httpget);
===========================
The code will executed. But the credentials will be not send.
The class PreemptiveAuth can be found in the example.
What is wrong? Any ideas?
Thanks for your help. :-)
Greetings,
Christian Blechert.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]