playframework - Can't set cookie with play framework -


i new play framework (1.2.4) , getting hard time working around setting cookies. i've read through 1.2.4 api doc can't find doing wrong. cookie doesn't set instead applications request cookie values this: index?name=user&value=123&duration=1d , page goes blank. render() doesn't called. lacking setting in application.conf? below code.

public static void setcookie(string name, string value, string duration) {     // setting cookie     system.out.println(">> setting cookie :" + name);     response.setcookie(name, crypto.sign(value), duration); }  public static http.cookie getcookie(string key) {     // retrieving cookie key     return http.response.current().cookies.get(key); } 

this call setcookie

public static void index() {     // code.     setcookie("user", "123", "1d");     render(); } 

this because when call setcookie play thinks calling different action (because setcookie method in controller, , public static void.

you can either make method private, or mark setcookie method @util annotation.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -