Bear Bibeault wrote:
Saket Kumar Sinha wrote:Not sure whether this is the appropriate way to do it
It is not. In fact, it is impossible to do that as there is no request and response with which to create the dispatcher.
You will need to create a servlet filter than can check if the session has expired or not. You will know if it has because you will have placed a token or some other object in the session to indicate the the user is logged in. If that object is missing, the session has expired or been destroyed.
Your filter can then take whatever action is required.