[jboss-user] [JBoss Seam] - Response.addCookie() not working in event model

monkeyden do-not-reply at jboss.com
Wed Oct 3 11:21:23 EDT 2007


Could someone tell me why this code wouldn't write the cookie once a Seam event is raised?  Appears to be something odd with the way the response is being handled.  Is there something that resets the response when we enter the Seam event model?


@Observer("org.jboss.seam.postAuthenticate")
  |     public void processRememberMe(){
  |         User user = (User)Component.getInstance("user", false);
  |         UserAccountBase userAccnt = (UserAccountBase) Contexts.getSessionContext().get("userAccount");
  |         FacesContext ctx = FacesContext.getCurrentInstance();
  |         String hash = encrypt(user.getUserName() + "." + user.getUserPassword());
  |         Cookie cookie = new Cookie("userKey", hash);
  |         cookie.setPath("/");
  |         cookie.setMaxAge(31536000);
  |         HttpServletResponse res = (HttpServletResponse)ctx.getExternalContext().getResponse();
  |         res.addCookie(cookie);
  |         userBO.addLoginCookie(hash, userAccnt.getUserKey());
  |     }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091108#4091108

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091108



More information about the jboss-user mailing list