i'm using in my actions a SessionMap (org.apache.struts2.dispatcher.SessionMap<K,V>)
to track my sessions.
I also use the method invalidate()
provided by SessionMap for logout.
Using the webapp "manager" provided by Tomcat, I can monitor sessions in my server.
When i want logout from my webapp i call the method invalidate()
.
But after calling this method the session doesn't expire!
Invalidate()
method only delete the object stored in the session (e.g. a user object created after login()
but the session exists.
Hoping my explanation is clear, how can i solve this problem? thanks in advance
My code:
public String execute(){
User user = authenticateUser( getUsername(), getPassword() );
if ( user == null )
{
/* User not valid, return to input page. */
return INPUT;
}
else{
session.put( "user", user );
}
return SUCCESS;
}
and I invalidate the session as follows:
public String logout(){
session.invalidate();
System.out.println("LOGOUT");
return "logout";
}
where session is:
private SessionMap<String, Object> session;