I you create an application containing '~' character cookies do non work properly, because the url set in the cookie encodes the ~ character in urlencoded format. For example if your context name is /~luigi The cookies send back to the client are with a path: /%74luigi This makes the server unable to recognize the sessionid, like cookies were disabled.
Fixed.
Hi, I am using Apache Tomcat/5.5.17. With this version I got the same result as described in the bug-report. Is it realy fixed? The Cookie.getPath() and Cookie.getDomain() returns always 'null'. My example program: package test; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class CookieAnzeige extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Returns a writer to write to the browser PrintWriter out = response.getWriter(); // Writes the string to the browser. out.println("Anzeige und Setzen von Cookies:"); Cookie[] cookies = request.getCookies(); if (cookies == null) out.println("Kein Cookie gesetzt!"); else { for (int i = 0; i < cookies.length; i++) { String cookieName = cookies[i].getName(); out.println("Cookie " + cookieName + " hat den Wert " + cookies[i].getValue() + " Pfad: " + cookies[i].getPath() + " Domain: " + cookies[i].getDomain()); } } Cookie Versicherungsnehmer = new Cookie("Versicherungsnehmer", "123456"); Versicherungsnehmer.setPath("/"); response.addCookie(Versicherungsnehmer); out.close(); } } The result: Anzeige und Setzen von Cookies: Cookie JSESSIONID hat den Wert A08AE263E7D9854C649BEA65CDE5056A Pfad: null Domain: null Cookie Versicherungsnehmer hat den Wert 123456 Pfad: null Domain: null
Sorry, my mistake !!! The correct Bug-Report-number is ASF Bugzilla Bug 16474.