Problem with storing Cookies

From: Blossom (BlossomBlossom70_at_hotmail.com)
Date: 04/29/04


Date: 29 Apr 2004 04:18:53 -0700

Hi there,

I have a problem with storing my Cookies. I made a servlet in which I
store a Cookie (in the doGet()-method) to detect whether a user has
already visited my webpage.

I used the following code:

Cookie c = new Cookie("sessionID", generateSessionID());
c.setMaxAge(60*60*24*365);
response.addCookie(c);

To test the Cookie I surfed to another website and then returned to my
servlet.
When I tried to retrieve the Cookie (with
HttpServletRequest.getCookies()) no Cookies were returned. The same
thing happened when I closed my browser, opened it again and returned
to my servlet. My browser is set to accept all posiible Cookies. Does
anybody know a solution to my problem?

Thanks in advance!



Relevant Pages

  • Re: hiding session ID in browser
    ... Store your data somehow indexed by this ID, ... properly with cookies enabled. ... > Problem why I don't want SessionID in browser is because when you add ... > web-site to favorites it stores SessionID too. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Installer with XCode?
    ... Unable to enter the requested store." ... your browser has stored some cookies or pasword for the ...
    (comp.sys.mac.programmer.help)
  • Cookie Counts
    ... accessed using cookies. ... one of the sites that my servlet is redirecting to is ... public class DirectIt2Servlet extends HttpServlet ...
    (comp.lang.java.programmer)
  • Cookie Confusion with jsp and servlets
    ... I'm using a standard Tomcat dir structure and web-mappings on WinXP ... and noticed that Cookies set by my servlets are not being read by my ... my server-side executables. ... And quoted from the Servlet 2.3 fcs: ...
    (comp.lang.java.programmer)
  • Re: Reading cookies problem
    ... but I can see in my browser that cookies are set OK, ... on the amount of cookie data sent is not OK? ... Just don't store 60 cookies on a client computer. ...
    (comp.lang.php)