1 package com.quikj.application.communicator.admin.controller; 2 3 import com.quikj.application.communicator.admin.model.*; 4 import com.quikj.server.framework.*; 5 import com.quikj.client.raccess.*; 6 7 import java.io.IOException ; 8 import java.util.*; 9 import javax.servlet.*; 10 import javax.servlet.http.*; 11 import java.sql.*; 12 import org.apache.struts.action.*; 13 14 15 22 23 public final class LogoffAction extends Action 24 { 25 26 27 29 30 45 public ActionForward execute(ActionMapping mapping, 46 ActionForm form, 47 HttpServletRequest request, 48 HttpServletResponse response) 49 throws IOException , ServletException 50 { 51 52 Locale locale = getLocale(request); 54 HttpSession session = request.getSession(); 55 56 Connection c = (Connection)request.getSession().getAttribute("connection"); 57 if (c == null) 58 { 59 return mapping.findForward("logon"); 60 } 61 else 62 { 63 try 64 { 65 c.close(); 66 } 67 catch (SQLException ex) 68 { 69 } 70 } 71 72 RemoteAccessClient cl = (RemoteAccessClient)request.getSession().getServletContext().getAttribute("remoteAccess"); 74 if (cl == null) 75 { 76 AceLogger.Instance().log(AceLogger.ERROR, AceLogger.SYSTEM_LOG, 77 "LogoffAction.execute(): Could not obtain RMI client object"); 78 } 79 else 80 { 81 try 82 { 83 String authcode = (String )request.getSession().getAttribute("authCode"); 84 85 if (authcode != null) 86 { 87 cl.getRemoteAccess().setParam("com.quikj.application.web.oamp.plugin.CommunicatorClientList", 88 "unregister:" + authcode, ""); 89 } 90 } 91 catch (Exception ex) 92 { 93 AceLogger.Instance().log(AceLogger.ERROR, AceLogger.SYSTEM_LOG, 94 "LogoffAction.execute(): RMIException: " + ex.getMessage()); 95 } 96 } 97 98 AceLogger.Instance().log(AceLogger.INFORMATIONAL, AceLogger.USER_LOG, 99 "User " 100 + ((AccountElement)(request.getSession().getAttribute("userInfo"))).getName() 101 + " logged out"); 102 103 session.invalidate(); 104 105 return (mapping.findForward("logon")); 107 } 108 109 110 } 111 | Popular Tags |