session - result contains no cookies when using result.withCookies -


please note: play framework newbie

intro

i need use session() and/or response().cookies pass data/store data.

at first session() started issue, cookies following along.

problem:

given basic example code below, have boolean value setting result, followed cookies being created , added result.

here on, mypage rendered, contains post action action within same controller, usercontroller

in new method, there no cookies. confirmed

collection<http.cookie> cookies = response().cookies(); 

with size of 0

usercontroller

//... result result; if(b)     result = ok(mypage.render()); else     result = new mycontroller().index(); result = result.withcookies(         new http.cookie("id", "value", 86400, "", "", true, false, http.cookie.samesite.lax),         new http.cookie("id_2", "value_2", 3600, "", "", true, false, http.cookie.samesite.lax)     );  return result; //... 

question:

the documentation states session() lasts entire duration while browser window open.

cookies stored client side , loaded when webpage loads, session regarded bunch of cookies.

why setting session() entries or adding cookies() shown above, cleared, i.e. no cookies available in response()?

what can for, remove session() or cookie entries?

well there no secret answer...

this not shown in question, cookies name or id may contain no spaces. causing problems. after removing spaces in name/id (values have spaces),

then issue resolved


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -