hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: Concurrency question
Date Sat, 10 Jun 2006 05:26:02 GMT
Hello Sidd,

> 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.

HttpClient wraps only the default HttpState object, for those that
don't need to maintain separate states.

> 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 trick is to choose the appropriate executeRequest(...) method.
This one will use the HttpState you pass as the third argument:

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConfiguration,%20org.apache.commons.httpclient.HttpMethod,%20org.apache.commons.httpclient.HttpState)

hope that helps,
  Roland

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


Mime
View raw message