Hi,
How do I set a cookie in a LiftFilter.doFilter method?
I tried to set the cookie as follows (stripped some code):
class AuthenticationFilter extends LiftFilter {
override def doFilter(request: ServletRequest, response: ServletResponse , chain: FilterChain) {
val cookie = new HTTPCookie("SomeCookie", Full("" + System.nanoTime), Empty,
Full("/authentication"), Full(60 * 60 * 24 * 14), Empty, Empty)
cookie.setPath("/somePath")
S.addCookie(cookie)
val httpResp = response.asInstanceOf[HttpServletResponse]
httpResp.sendRedirect("/some/page.html")
}
}
However, when I check the browsers cookie, no cookie is set (apart from JSESSIONID), and I know the doFilter method is being executed because of logging messages and the fact that the browser is redirected to /some/page.html.
I'm using Scala 2.8, Lift 2.1-SNAPSHOT and the app is running is GAE (1.3.6, only tested on dev_appserver so far).
Any ideas? Thanks,
Gero