logoutaction.java
来自「A Java web application, based on Struts 」· Java 代码 · 共 60 行
JAVA
60 行
/* @LICENSE_COPYRIGHT@ */package net.sf.irunninglog.servlet.action;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import net.sf.irunninglog.servlet.RequestProcessor;import net.sf.irunninglog.servlet.UserContainer;/** * Log the current user out of the application. This will invalidate the * user's HTTP session and transition him to the appropriate resource. * * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a> * @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:00 $ * @since iRunningLog 1.0 */public final class LogoutAction extends BaseAction { /** <code>Log</code> instance for this class. */ private static final Log LOG = LogFactory.getLog(LogoutAction.class); /** * Log the user out of the application and forward control to the * logout page. * * @param mapping The <code>ActionMapping</code> used to select this * instance * @param form The optional <code>ActionForm</code> bean for this request * @param request The HTTP request being processed * @param response The HTTP response being processed * @param container The <code>UserContainer</code> object for the current * user * @return The forward describing where/how to forward control * @exception Exception if the application business logic throws * an exception */ public ActionForward executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, UserContainer container) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("executeAction: Logging '" + container.getUserName() + "' out of the application"); } container.logout(); return mapping.findForward(RequestProcessor.FORWARD_SUCCESS); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?