Wednesday, July 30, 2014

Why Cookies will not be stored if setting Timeout = 30 days in GWT?

This is very weird. Ok, the below code works fine

public void setCookie(String cookiesName, String cookiesValue){      final int COOKIE_TIMEOUT = 1000 * 60 * 60 * 24;//1 days      Date expires = new Date((new Date()).getTime() + COOKIE_TIMEOUT);      Cookies.setCookie(cookiesName, cookiesValue, expires);  }  //then  setCookie("currentLang","de");  Collection<String> cookies = Cookies.getCookieNames();  for(String cookie : cookies){          if("currentLang".equals(cookie)){                System.out.println("got currentlang");          }  }  

If i run the above code then I can see output: "got currentlang" However, if I set timeout=30 days final int COOKIE_TIMEOUT = 1000 * 60 * 60 * 24 * 30;//30 days, then nothing got printed out, so "currentLang" has not even been stored if we set 30 days?

Why is that? does Gwt prevent that to happen?

http://stackoverflow.com/questions/25049270/why-cookies-will-not-be-stored-if-setting-timeout-30-days-in-gwt

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment