Hello,
Ive a little question about cookies. Ive a MultiThreadedHttpConnectionManager, and I get an HttpClient instance from it. This httpclient object IS SHARED by all threads of my servlet (it means, I only have 1 instance of httpclient). I set the RFC-2109 in this way: HttpClient objHttp = new HttpClient(new MultiThreadedHttpConnectionManager()); objHttp.getParams().setCookiePolicy(CookiePolicy.RFC_2109); Now I want to set cookies to this httpclient using httpstate. The following piece of code is executed by every thread (every request) of my servlet: HttpState initialState = new HttpState(); initialState.addCookie(new org.apache.commons.httpclient.Cookie(value_for_this_request, ..)); objHttp.setState(initialState); The question is: doing this, am I setting this cookie for all threads or just for the current thread that is executing this code? Obviously, I want to set this cookie just for the current thread, not for all. Is this correct? And if not, how should I do it? Maybe set the cookies at method level using method.setRequestHeader and setting the Cookie header and its value as string? And the following question is: this request is sent to another servlet, that reads it. But if I examine the HttpServletRequest, I always get null for cookies attribute. Its like httpclient is not including the cookie in the request Im sending to the remote servlet. But why? Is it not enough specifying the cookie policity at httclient params level? Thanks a lot, Joan.