Yes, if I just do a simple cookie, I can set/get just fine:
Cookies.setCookie("ce", emailField.getText().trim());
String cookieEmail = Cookies.getCookie("ce");
This shows the cookie retrieved just fine, as expected for such a
simple thing.
But when I try to put the expiry, I can't retrieve it. I've tried
setting the path param to null, and to "/" and that makes no
difference. It appears to be the expiring time since if I put null
there, it works just fine, but I would like my cookies to expire after
90 days:
long msecs = 90*24*60*60*1000; // 90 days in milliseconds
java.util.Date expDate = new java.util.Date(System.currentTimeMillis()
+ msecs);
Cookies.setCookie("ce", emailField.getText().trim(), expDate, null,
EsfUtil.getContextPath()+"/", EsfUtil.isRequestSecure());
String cookieEmail = Cookies.getCookie("ce");
In the above, it cannot get the cookie (returns null).
But if expires date is null, it works fine:
Cookies.setCookie("ce", emailField.getText().trim(), null, null,
EsfUtil.getContextPath()+"/", EsfUtil.isRequestSecure());
String cookieEmail = Cookies.getCookie("ce");
Is there something I'm doing wrong about the expiring? I understand
there are issues with 'long' in javascript and maybe it's causing the
problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---