views:

13

answers:

0

I'm not seeing it in docs, good to check here:

Does HttpClient manage HTTP authorization (preemptive or otherwise) with credentials in the URL line?

For instance http://foo:bar@hostname/Hello/World inlines username foo and password bar for authorization (actually authentication, but just using same nomenclature).

Basically:

HttpClient client = new HttpClient();
GetMethod get = new GetMethod("http://foo:bar@hostname/Hello/World");

vs.

HttpClient client = new HttpClient();
client.getState().setCredentials(
          new AuthScope( /* stuff */ );
        , new UsernamePasswordCredentials("foo","bar");
);
GetMethod get = new GetMethod("http://foo:bar@hostname/Hello/World");
get.setDoAuthentication(true);

I tried it no joy, but was hoping I might be doing something wrong?

Thanks,