hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: HttpClient initialization, when/where?
Date Wed, 12 May 2004 08:11:47 GMT
Hello,

you need one HttpState for each thread, since the cookies
are stored there. Creating a new state for each request will
not work, unless the threads manage the cookies themselves.

The HttpClient is associated with a connection pool. If
you require independently configured connection pools
for each thread, you have to create multiple HttpClient
objects. Otherwise, one HttpClient with MultiThreadedHCM
is ok.

hope that helps,
  Roland






Cabbar Duzayak <dcabbar@yahoo.com>
12.05.2004 09:32
Please respond to "Commons HttpClient Project"
 
        To:     commons-httpclient-dev@jakarta.apache.org
        cc: 
        Subject:        HttpClient initialization, when/where?


Hi,

I will be writing a gateway which will invoke URLs in
behalf of several threads and they will return the
content. Each thread needs to invoke different URLs
with different context (cookies, etc).

It looks like right way of doing this is to
instantiate the HttpClient once with
MultiThreadedHttpConnectionManager and each thread
will use httpClient.executeMethod on this HttpClient
instance. Or the other alternative is to instantiate
one object for each thread, and keep calling
executeMethods on them. 

However, since you can set the state of the
HttpClient, I was wondering if I can use the
HttpClient for iterative http invocations with
different contexts? I mean, is there an in-memory
state other than the HttpState that is preserved
between these invocations? Would it be enough to
create an HttpState and GetMethod for each call, and
set it before calling executeMethod? 

Shortly, what is the optimum mechanism for this
functionality?

TIA...



 
 
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861 

---------------------------------------------------------------------
To unsubscribe, e-mail: 
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: 
commons-httpclient-dev-help@jakarta.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message