On Tue, 2013-10-29 at 14:14 -0600, Dennis Heimbigner wrote:
> After I have materialized the HttpClient
> instance using HttpClientBuilder.build(),
> I later may need to change the associated
> information such as proxy and user agent.
> I can find no non-deprecated mechanism for doing this.
> What is the proper way to do this?
>
User agent is just a normal header.
---
HttpGet get = new HttpGet("/");
get.setHeader(HTTP.USER_AGENT, "blah");
---
Credentials provider, auth cache, cookie store can be set as execution
context attributes.
---
CredentialsProvider credentialsProvider = new
BasicCredentialsProvider();
HttpClientContext context = HttpClientContext.create();
context.setCredentialsProvider(credentialsProvider);
---
Proxy can set as a request parameter.
---
RequestConfig requestConfig = RequestConfig.custom()
.setProxy(new HttpHost("proxy"))
.build();
get.setConfig(requestConfig);
---
Hope this helps.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]