yesun
if(authPolicy.toUpperCase().equals("BASIC"))
  {
   URL uri = new URL(postUrl);
   List<String> authPrefs = new ArrayList<String>(1);
   authPrefs.add(AuthPolicy.BASIC);
   httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
   httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort(), AuthScope.ANY_REALM),new NTCredentials(username, password, uri.getHost(), domain));
   state = httpClient.getState();
  }
  else
  {
   if(state != null)
    httpClient.setState(state);
  }

NTLM/DIGEST同理

分类:

技术点:

相关文章:

  • 2021-11-14
  • 2021-09-03
  • 2021-12-02
  • 2021-12-31
  • 2022-01-03
  • 2021-08-12
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2022-01-08
  • 2022-01-19
  • 2022-12-23
相关资源
相似解决方案