AuthPNames.CREDENTIAL_CHARSET
已被弃用!?
我不知道如何解读:
(4.3)使用RequestConfig和构造函数参数 AuthSchemeProviders。
有谁能举个例子?
答案 0 :(得分:1)
Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
.register(AuthSchemes.BASIC, new BasicSchemeFactory(Consts.UTF_8))
.register(AuthSchemes.DIGEST, new DigestSchemeFactory(Consts.UTF_8))
.register(AuthSchemes.NTLM, new NTLMSchemeFactory())
.register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory())
.register(AuthSchemes.KERBEROS, new KerberosSchemeFactory())
.build();
CloseableHttpClient client = HttpClients.custom()
.setDefaultAuthSchemeRegistry(authSchemeRegistry)
.build();