开发者

Does Apache's HttpClient manage inlined URL authentication?

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 开发者_如何学Cauthorization (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.
Am I something wrong?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜