On Wed, 2010-06-02 at 16:19 -0400, [email protected] wrote: > Hi, > > I am using HttpClient 4. > > I am using Httpclient from an applet. I'am trying to extract the jsessionid > and ltpa cookie from the browser to pass it to my HttpClient objtect contain > in my applet. Of course, it's not working. Any idea or code sample will be > appreciate. Here's the method that take the cookie and pass it to HttpClient : > > public void addCookies(String strCookies) { > if (strCookies != null & strCookies.length() > 0) { > CookieStore cookieStore = new BasicCookieStore(); > > String[] listeCookies = strCookies.split(";"); > for (int i = 0; i < listeCookies.length; i++) { > String[] unCookie = listeCookies[i].split("="); > if (unCookie != null && unCookie.length == 2) { > BasicClientCookie bcc = new > BasicClientCookie(unCookie[0], unCookie[1]); > cookieStore.addCookie(bcc); > } > } > > getHttpContext().setAttribute(ClientContext.COOKIE_STORE, > cookieStore); > } > } > > > Thanks, > François
If you do not set correct values for the domain and path attributes, the cookie will never get matched to the server of origin. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
