Hello Sven,

browsers make requests in parallel for *one* user!
Meaning that all the cookies returned end up in the
same cookie store, as they do here.
A proxy servlet will make requests for different users
(browsers) and therefore has to maintain a different
state for each user. That state is typically associated
with the session between the browser and servlet.

I have rewritten our own proxy servlet to optionally use
the HTTP Client instead of the HttpURLConnection,
and I didn't encounter problems with parallel requests
by now. Which could also indicate that I didn't have
enough time to test it thoroughly yet :-)
Anyway, I handle "cookie" and "set-cookie" headers
manually and use a single state object that does
never store any cookies. And when manually handling
the cookies, I use a "CookieBox" class that gets
instantiated once for each session.
It's either that, or different state objects for each
session. But you can't just throw all cookies returned
for all users into a single state and expect the HTTP
client to figure out which cookie belongs to which
user.

regards,
  Roland

 




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


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

Well, it's a that odd application of the HttpState-Object since every 
browser makes multiple requests to a server in parrallel. So this would 
be a feature i would request.

Well, most methods of HttpState seem to be synchronized, but as i 
already mentioned, it's pretty easy to easy to solve any "bad mix-up".

What i don't want is to serialize (meaning executing one after another) 
the HTTP-Requests. I want them to execute in parralel.


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


Reply via email to