ドキュメントには表示されません。ここで確認してください。
HttpClient
URL 行の資格情報を使用して、HTTP 認証 (プリエンプティブまたはその他) を管理しますか?
例: 承認のためにユーザー名とパスワードをhttp://foo:bar@hostname/Hello/World
インライン化します(実際には認証ですが、同じ命名法を使用しているだけです)。foo
bar
基本的:
HttpClient client = new HttpClient();
GetMethod get = new GetMethod("http://foo:bar@hostname/Hello/World");
対:
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);
私はそれを試してみました。
私は何か間違っていますか?