The source code of MaintainSessionKill.java: // Kill current session (if any) import java.io.* ; import javax.servlet.* ; import javax.servlet.http.* ; import java.util.* ; // for Date public class MaintainSessionKill extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request,response) ; } // doPost public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html") ; PrintWriter out = response.getWriter() ; Furniture.doHeader(out,"Terminate current session") ; HttpSession session = request.getSession(false) ; // Will NOT create new session if none exists if (session == null) { out.println("<p>No current session") ; } else { out.println("<p>There is a current session ...") ; out.println("<p>Session ID : " + session.getId()) ; out.println("<br>Creation time : " + new Date(session.getCreationTime())) ; out.println("<br>Last access time : " + new Date(session.getLastAccessedTime())) ; try { session.invalidate() ; out.println("<p><b>Session killed</b>") ; } catch (IllegalStateException e) { out.println(e.getMessage()) ; } } Furniture.doFooter(out) ; } // doGet } // class