Hi all,
Hi,
Currently, i am facing a difficulty in invalidating a session in a class that has implemented HttpBindingListener. The purpose of this is to invalidate the session when the session timeout is reached.
When i wrote the following codes, it gave me an exception.
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession sessNew = request.getSession(true);
request.setAttribute(usrID,sessNew);
sessNew.setMaxInactiveInterval(sessTimeOut);
sessNew.setAttribute("TimeoutSession", new SessionTimeoutListener());
}
public void valueUnbound (HttpSessionBindingEvent event){
try{
if(event.getSession() != null){
HttpSession sess =event.getSession();
sess.invalidate();
catch(Exception ex){
ex.printStackTrace();
System.out.println("Exception occurred");
}
}
So is there anyway for me to invalidate the session in this case? Your reply is much appreciated.
Thanks,
Regards,
Pak Kin