Hello Sven,

unless you have taken special precautions, the state object
is used to store cookies. Using the same state from different
threads can mix up the cookies from different clients pretty
badly.
Once you have the cookie problem solved, there is no issue
with using the same state object. I dimly remember seeing
some synchronized statements in there. Anyway, except for
storing cookies, it is accessed read-only.

regards,
  Roland







Sven K�hler <[EMAIL PROTECTED]>
12.11.2003 15:02
Please respond to "Commons HttpClient Project"
 
        To:     Commons HttpClient Project 
<[EMAIL PROTECTED]>
        cc: 
        Subject:        Re: Cookies, Chunked-Post & Threads


> HttpClient.executeMethod
>    (HostConfiguration, HttpMethod, HttpState)
> 
> If you have used the same client from different
> threads without specifying different states, that
> might be a problem.

Well, i use this method now from different thread with different 
HttpStates. I'd like to use even one HttpState-Object from different 
threads! Is that possible. I'm doing that right now, but i'm not sure if 
  the HttpClient-APIs cares about that case.

If not, that would be very easy:

synchronized (state)
{
   //get cookie headers
}

//execute HTTP-request

synchronized (state)
{
   //put cookie header
}



---------------------------------------------------------------------
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]


Reply via email to