hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sharma, Siddharth" <Siddharth.Sha...@Staples.com>
Subject Concurrency question
Date Fri, 09 Jun 2006 23:14:11 GMT

I am using httpclient-3.0-rc4.
I am writing a wrapper around httpclient.
We will use this wrapper (and so the wrapped httpclient api) to make
conversational B2B requests with remote services over https(s) and
content-type text/xml.

In other words, the client is a J2EE container in which our application runs
and the target is an arbitrary xml over http(s) service. It is important to
note that even though the client is the application server, the conversation
needs to be maintained on behalf of the end-browser OR the application
server is making the request to the remote service on behalf of the end

Since the connection needs to be conversational, we need to maintain
cookies. I noticed the class that wraps this is HttpState.
HttpClient wraps this class.
But the page 'Optimization Guide'
http://jakarta.apache.org/commons/httpclient/performance.html states that it
is better to reuse httpclient. But if httpclient maintains state for a
client, how can it be reused?

So I declared HttpClient as static to reuse it for all requests to all
remote services. And I passed it the MultiThreadedHttpConnectionManager for
handling concurrent requests. But I cannot figure out how to set HttpState
in a thread-safe manner. The easiest way is to create HttpClient per user
request but that is contradictory to the optimization guide's reuse

Am I missing something here?
Is it a wrong assumption that httpclient can be reused even for
conversational requests?
Is it a wrong assumption that httpclient can be reused for all remote
services? Or it should only be reused for each unique HostConfiguration?

Thanks in advance

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

View raw message