AdminLogoutAction.java
01 package com.bea.medrec.actions;
02 
03 import com.bea.medrec.utils.MedRecLog4jFactory;
04 import com.bea.medrec.utils.MedRecWebAppUtils;
05 import javax.servlet.http.HttpServletRequest;
06 import javax.servlet.http.HttpServletResponse;
07 import org.apache.log4j.Logger;
08 import org.apache.struts.action.ActionForm;
09 import org.apache.struts.action.ActionForward;
10 import org.apache.struts.action.ActionMapping;
11 import weblogic.servlet.security.ServletAuthentication;
12 
13 /**
14  <p>Adimn logout controller.  Handles all request during the logout
15  * process.</p>
16  *
17  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
18  */
19 public class AdminLogoutAction extends AdminBaseAction{
20 
21   private static Logger logger =
22       MedRecLog4jFactory.getLogger(AdminLogoutAction.class.getName());
23 
24  /**
25   <p>Process the specified HTTP request, and create the corresponding HTTP
26   * response (or forward to another web component that will create it).
27   * Return an <code>ActionForward</code> instance describing where and how
28   * control should be forwarded.
29   <br>
30   * Invalidates session and redirects to MedRec homepage.
31   </p>
32   *
33   @param mapping  The ActionMapping used to select this instance
34   @param form  The optional ActionForm bean for this request (if any)
35   @param request  The HTTP request we are processing
36   @param response  The HTTP response we are creating
37   */
38   public ActionForward executeAction(ActionMapping mapping,
39                                      ActionForm form,
40                                      HttpServletRequest request,
41                                      HttpServletResponse response)
42     throws Exception
43   {
44     logger.info("Logging out user.");
45 
46     logger.debug("Invalidating session.");
47     ServletAuthentication.invalidateAll(request);
48 
49     // Return to MedRec start page.
50     return mapping.findForward("medrec.startpage");
51   }
52 
53 }