Brijesh Deo wrote:
Thanks for providing a proper understanding of the subject matter here.
I will try to give it a shot by using one HttpClient instance and see
how it goes.
Otherwise, as you have suggested, multiple HttpClient instances using
one shared connection manager instance looks very convincing to me.
With that approach, I can also run a connection eviction thread to close
and release expired/idle connections periodically. Otherwise with
multiple connection manager instances, it's quite a challenge to run
such a thread.
However, I have a couple of questions.
Q1) In case the same http/connection parameters exist in both the
HttpClient instance and the Connection Manager instance, which will take
precedence over the other?
Connection managers can use a completely separate set of HTTP
parameters. For convenience one can pass the same HttpParams instance to
the connection manager and HttpClient instances.
Q2) When I use a single HttpClient instance, how can I preserve the Http
state information corresponding to various target hosts? Is it possible
to use those Http State information at the HttpRequest level?
Since in 4.0, there is no HttpState interface, I believe I need to store
and preserve the Cookies and use it at the HttpRequest level. Would it
be the right thing to do?
You should be using a separate HttpContext instance per target host. You
may also want to create a separate CookieStore instance per context.
For details see:
http://hc.apache.org/httpcomponents-client/tutorial/html/statemgmt.html#d4e793
Hope this helps
Oleg
Thanks for providing your valuable time to answer my queries.
Thanks,
Brijesh
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]