⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logoutaction.java

📁 《基于Eclipse的开源框架技术与实战》[第5章]随书源码
💻 JAVA
字号:
package com.free.struts.storefront.security;

import java.util.Locale;
import javax.servlet.http.*;
import org.apache.struts.action.*;

import com.free.struts.storefront.customer.view.UserView;
import com.free.struts.storefront.framework.StorefrontBaseAction;
import com.free.struts.storefront.framework.UserContainer;
import com.free.struts.storefront.framework.exceptions.BaseException;
import com.free.struts.storefront.framework.util.IConstants;
import com.free.struts.storefront.service.IStorefrontService;

/**
 * <p>Title: Eclipse Plugin Development</p>
 * <p>Description: Free download</p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: Free</p>
 * @author gan.shu.man
 * @version 1.0
 */

public class LogoutAction extends StorefrontBaseAction {
  public ActionForward execute( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
    throws Exception {

    HttpSession session = request.getSession(false);
    // Make sure the user has a valid session
    if(session != null) {
      if(getUserContainer(request) != null) {
        // Login through the security service
        IStorefrontService serviceImpl = this.getStorefrontService();
        serviceImpl.logout( getUserContainer(request).getUserView().getEmailAddress());
        getUserContainer(request).cleanUp();
      }
    }
    return mapping.findForward( IConstants.SUCCESS_KEY );
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -