Hello, I use HttpClient 2.0.2 I have a little problem with cookies. I write a servlet, to work as a kind of proxy to a different http server. So I take my HttpServletRequest, rewrite it's method, and header to a HttpClient and execute that method. After that, I take a response from method, rewrite header to HttpServletResponse and rewrite also a body (binary). And everythink works fine but I have a little problem with cookies. When a cookie came with header from HttpClient (Set-cookie), it is just rewritten to HttpServletResponse and I can see in my browser then that cookie with proper value. When I try to sent a cookie to HttpClient from HttpServletrequest: I know that it can't be rewritten with header (I've found that in archive). So I write:
String url = "http://www.my.address.org/" HostConfiguration config = new HostConfiguration(); config.setHost(url, 80); HttpClient client = new HttpClient(); HttpState state = client.getState(); Cookie myCookie = new Cookie(url, some_name, some_value); state.addCookie(myCookie); PostMethod method = new PostMethod(url); //I use post and get method // add header, and parameters here client.executeMethod(config, method, state); and when I look at the things which where sent to the server i can see that there are no cookie header at all. Rest of the package looks ok (there is rest of the headers and protocol and everything as it should be). The name and value i take from a cookie which where sent to me by HttpServletRequest, and I have checked them, there are ok. What is wrong? What is the correct way to add a cookie to request? Marcin Piatek ---------------------------------------------------------------------- Startuj z INTERIA.PL!!! >>> http://link.interia.pl/f1837 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
