In a click handler for a checkbox to "save email", I have the
following code:

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,
Window.Location.getPath(), EsfUtil.isRequestSecure());
GWT.log("checkbox set cookie",null);
String cookieEmail = Cookies.getCookie("ce");
GWT.log("checkbox get same cookie value as: " + cookieEmail,null);

Why would it be I cannot retrieve a cookie right after setting it?
I'm using GWT 1.7.1.

The hosted browser log shows:
[INFO] checkbox set cookie
[INFO] checkbox get same cookie value as: null

I also noted that in my GWT RPC service, the server code does not have
the cookie either, so it's not like it is set and then being passed to
the server (though I'd expect it to).  In reality, this cookie is only
for the browser convenience of keeping the email address to aid
subsequent logins if they've checked the box to have it.

Thanks,
David

P.S.
EsfUtil.isRequestSecure() is just a simple query to see if I'm https
or not (in production, it's always https and we to use secure cookies
then, but while testing on a local PC it never is)

        public static boolean isRequestSecure() {
                return Window.Location.getProtocol().equals("https:");
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to