Search code examples
jakarta-eecoldfusioncoldfusion-10mxunit

session invalidate and creating a new session


I'm using ColdFusion 10 and J2EE session variables. To log a user out (end a session) I'm using getPageContext().getSession().invalidate() this works fine until I run my MXUnit tests and one of them tests the logout process. The session is invalidated and subsequent tests fail because there is not an active session. Is there a way to create a new session without reloading the page?


Solution

  • For better visibility from the comments

    I don't think you can create a new session without sending/receiving data from the client. There is a note on the page that you referenced (at the bottom):

    You cannot destroy the session and create a session on the same request, as creating a new session involves sending session cookies back.