Thank you Oleg, I was not able to keep the "hostconfiguration" parameter to null in
httpclient.executeMethod(null, httpget1, httpstate1); I had to set it to httpClient.getHostConfiguration()... In fact, i want to access the same logical web application "http://www.whatever.com/app" on one physical server, but from two different logical users. When i execute your sample, httpget1 and httpget2 has the same session ID if i connect to the same web app ("http://www.whatever.com/app"). The cookie automatically sent by HttpClient on httpget2 is the same as the one received from httpget1. So the server see my two connections as if they were from the same user... How to handle that??? I mean: is there a way to tell to HttpClient to maintain distinct cookies on distinct state? Fabien -----Message d'origine----- De : Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Envoyé : jeudi 26 août 2004 10:50 À : Commons HttpClient Project Objet : Re: How to use two distinct HttpClients on the same web site Fabien, If all you need is to maintain a distinct conversational state per logical web application hosted on the same physical platform, you should have just only one HttpClient instance and then keep different HttpState instances per web application. It does take a bit of HttpState juggling, but the benefit of such setup will be a better overall performance, as HttpClient would be able to reuse physical connections to the host. ================================================================= HttpClient httpclient = new HttpClient(); HttpState httpstate1 = new HttpState(); GetMethod httpget1 = new GetMethod("http://www.whatever.com/app1"); try { httpclient.executeMethod(null, httpget1, httpstate1); System.out.println(httpget1.getStatusLine()); System.out.println(httpget1.getResponseBodyAsString()); httpstate1.getCookies(); } finally { httpget1.releaseConnection(); } HttpState httpstate2 = new HttpState(); GetMethod httpget2 = new GetMethod("http://www.whatever.com/app2"); try { httpclient.executeMethod(null, httpget2, httpstate2); System.out.println(httpget2.getStatusLine()); System.out.println(httpget2.getResponseBodyAsString()); httpstate2.getCookies(); } finally { httpget2.releaseConnection(); } Hope this helps Oleg On Thu, 2004-08-26 at 08:46, Fabien BALAGEAS wrote: > Hi, > > I am using HttpClient 2.0.1. > > I would like to have two HttpClient connections to the same web site > in my application, but from two "distinct" HttpClient (i.e. each > connection should handle its self cookies). > > How can i realize this task ? > > Up to now, i only managed to have two connections to the web site, but > with the same cookies sent, so the web site see my two connections as > if they were one. > > Thanks in advance for your help, > Fabien > *************************************************************************************************** The information in this email is confidential and may be legally privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system. *************************************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]