On Wed, 2018-05-16 at 17:09 +0300, / wrote:
> Hi there,
> 
> I am looking for an example on how to configure HttpClient5 after it
> has 
> been built and how to extract/print some of its configuration.
> 
> Once I have an HttpClient object, how do I go about and change some
> of 
> its settings, for example connection timeout or user-agent-string or 
> even cookie jar?
> 

HttpContext is your best friend

https://github.com/apache/httpcomponents-client/blob/master/httpclient5
/src/examples/org/apache/hc/client5/http/examples/ClientCustomContext.j
ava

Any bit of contextual details for request execution should be there (or
should go there)

Hope this helps.

Oleg

> I am looking for the most straight-forward and efficient way to do
> this. 
> I don't care about "fluent" APIs neither about streams etc.
> 
> something like:
> 
> myclient.setParameter(connection_timeout, 1000);
> 
> or
> 
> System.out.println(myclient.getParameter(user_agent_string));
> 
> is that possible at all? or shall I start prepare for the climb on
> the 
> long-winded road to the Castle - "oh! howdy Kafka!" ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to