Reputation: 9608
Is there a way to set a session variable AFTER the response has been delivered?
I want to avoid that any filter will see this change in the current request.
To clarify the context I will talk about the use case.
My task is to adapt a complex Java EE application (Spring, acegi, struts, JSP, Apache Tiles, aso) to user needs. Users could login to this application.
If a user account is used a second time, the new session should warn that continuing will invalidate the original session.
Any request after presenting the warning (due to clicking a link) should invalidate the original session.
One problem is, that currently setting session variable were visible to other (spring) filters.
Upvotes: 0
Views: 199
Reputation: 5269
You can create a filter which is the first in the filter chain. This filter will be called last when the request is postprocessed. And you can set the session variable when the filter is called the second time.
Upvotes: 1
Reputation: 109557
If you have a session, you can keep a variable only server-side. Keeping it in a session bean would be the normal procedure. Quite simple.
Upvotes: 0