1 22 package org.jboss.ejb3.test.dd.web.servlets; 23 24 import java.io.IOException ; 25 26 import javax.servlet.ServletException ; 27 import javax.servlet.http.HttpServlet ; 28 import javax.servlet.http.HttpServletRequest ; 29 import javax.servlet.http.HttpServletResponse ; 30 import javax.servlet.http.HttpSession ; 31 32 39 public class LogoutServlet extends HttpServlet 40 { 41 protected void processRequest(HttpServletRequest request, HttpServletResponse response) 42 throws ServletException , IOException 43 { 44 HttpSession session = request.getSession(false); 45 if (session != null) 46 { 47 session.invalidate(); 48 } 49 50 response.sendRedirect(request.getContextPath() + "/index.html"); 51 } 52 53 protected void doGet(HttpServletRequest request, HttpServletResponse response) 54 throws ServletException , IOException 55 { 56 processRequest(request, response); 57 } 58 59 protected void doPost(HttpServletRequest request, HttpServletResponse response) 60 throws ServletException , IOException 61 { 62 processRequest(request, response); 63 } 64 } 65 66 | Popular Tags |