So just to clarify, when accessing index.html, using S.addCookie isn't working? Any chance you can post an example project (https://www.assembla.com/spaces/liftweb/wiki/Posting_example_code)
I have similar issue but mine is more narrow. Setting cookies in earlyInStateful generally works, but not when the request is missing or has expired JSESSIONID. So if I manually remove JSSESSION id, and then hit refresh on index.html, then S.addCookie and S.removeCookie won't do anything. This is quite annoying because the extended session functionality is completely broken due to this issue because I can't reset extended session cookie when JSESSIONID is abscent.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to a topic in the Google Groups "Lift" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/liftweb/zqlmY7M1cos/unsubscribe.
To unsubscribe from this group and all its topics, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
S.notice("early before setData, cookie " + currentCookie + ", data " + currentData)
val time = System.currentTimeMillis().toString
S.notice("early at " + time + " before setData, cookie " + currentCookie + ", data " + currentData)
setData(time)
Firstly, it seems like S.addCookie doesn't update the value of the cookie that is seen by S.findCookie later in the request processing. So if you just keep refreshing "/", you can see that the "Cookie value:" in the snippet is always one update behind the session var - it shows the value of the cookie received from the browser even if a new cookie will be set by the response. I guess this one probably is deliberate, but it confused me a little at first.
Secondly, and more importantly for this issue, the setData in this case manages to set both the SessionVar and the Cookie. We are still doing the same operations - reading both the SessionVar and the cookie, then writing both of them, but this time it works.