Ultimate Fighter
Ultimate Fighter

Reputation: 1797

How can i set credential charset with httpclient 4.3

AuthPNames.CREDENTIAL_CHARSET is deprecated!?

I don't know how to interpret:

(4.3) use RequestConfig and constructor parameters of AuthSchemeProviders.

From the documentation.

Can anyone give me an example?

Upvotes: 1

Views: 405

Answers (1)

ok2c
ok2c

Reputation: 27538

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();

Upvotes: 1

Related Questions