Javaプロキシクラスを使用して、それをHttpURLConnection.openConnection()に渡します。
Proxyクラスに認証情報(http.proxyUserやhttp.proxyPasswordのように)を提供する方法はありますか?
ありがとう
1 に答える
2
その目的でAuthenticatorを使用できます。
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("login", "password".toCharArray());
}
});
于 2012-05-23T10:30:58.177 に答える