tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trond G. Ziarkowski" <trond.ziarkow...@gep-as.com>
Subject Cookies in Tomcat 5.5.7
Date Wed, 16 Feb 2005 10:50:51 GMT
Hi all!

I'm making a filter that checks that my cookies are set, and sets them 
if they are missing.

Code for setting cookie:
        String path = request.getContextPath();
        cookie = new Cookie(name, value);
        cookie.setPath(path);
        logger.debug("Setting cookie: " + cookie.getName() + ", " + 
cookie.getPath());
        response.addCookie(cookie);

Code for checking cookies:
            String path = request.getContextPath();
            for (Cookie c : cookies) {
                String cName = c.getName();
                String cPath = c.getPath();
                logger.debug("Checking: " + cName + ", " + cPath);
            }

When setting the cookie the Cookie.getPath() method returns the path I 
have set. But when checking cookies all calls to Cookie.getPath() 
returns null regardless of what path I have set. When viewing the 
cookies in Firefox the path is the same as when I created the cookie.

Is this a bug?
Has anyone experienced similar behaviour?


Trond


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message