Hello Oleg,
Im trying to send cookies to a servlet with a simple app. Following the tutorial: HttpContext localContext = new BasicHttpContext(); CookieStore cookieStore = new BasicCookieStore(); BasicClientCookie stdCookie = new BasicClientCookie("name", "value"); stdCookie.setVersion(1); stdCookie.setDomain(".mycompany.com"); stdCookie.setPath("/"); stdCookie.setSecure(true); // Set attributes EXACTLY as sent by the server stdCookie.setAttribute(ClientCookie.VERSION_ATTR, "1"); stdCookie.setAttribute(ClientCookie.DOMAIN_ATTR, ".mycompany.com"); cookieStore.addCookie(stdCookie); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); HttpEntity entity = objHttp.execute(objPost, localContext).getEntity(); This does not work (at least for me). To work, you need to add: stdCookie.setAttribute(ClientCookie.PATH, "/"); If I forget any of the set statement, or any of the setAttribute statement, it does not work. The question is: Why have we to set twice the components of the BasicClientCookie, the first using stdCookie.set and the second using stdCookie.setAttribute? And should I set ClientCookie.SECURE_ATTR and ClientCookie.MAX_AGE_ATTR ? And the second part: when the servlet receives this cookie, it is resent to another servlet using the same sequence of operations. But debugging, one can see that the cookie is not added to the cookieStore (the sentence cookieStore.addCookie(stdCookie); does not add anything to cookieStore). Can you help me? Thanks in advance, Joan.