我对这应该如何工作感到非常困惑。我试过使用这样的东西:
con = (HttpURLConnection) url2.openConnection();
con.setReadTimeout(10000);
con.setInstanceFollowRedirects(true);
con.setAllowUserInteraction(true);
con.setDoOutput(true);
con.setDoInput(true);
Authenticator.setDefault(new MyAuthenticator());
con.connect();
class MyAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("myUser", "MyPassword".toCharArray());
}
}我得到了这个方法返回的401错误,所以很明显我没有抓住要点。根据chart的说法,JRE6应该支持NTLMv2。我的困惑在于这是在Android上运行的。在getOutputStream抛出的异常的堆栈跟踪中,我看到引用了HttpURLConnection的Apache实现。
根据我在研究中发现的情况,由于许可问题,Apache无法包含NTLMv2协议。这就是它在android上不起作用的原因吗?
无论哪种方式,我都想知道Java是如何做到这一点的,而不仅仅是Android。
发布于 2010-10-06 17:23:33
它没有被实现。看看这一期:http://code.google.com/p/android/issues/detail?id=4962。还要考虑这样一个事实,Android不是JRE6,它是标准Java的修改版本。
https://stackoverflow.com/questions/3869771
复制相似问题