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

📄 adminauthinterceptor.java

📁 是一个网站的博客系统
💻 JAVA
字号:
package com.opensource.blog.web.interceptor;

import net.sf.struts.saif.ActionHaveForwardInterceptor;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import javax.servlet.ServletException;
import com.opensource.blog.comm.*;
import com.opensource.blog.web.action.*;


public class AdminAuthInterceptor
    implements ActionHaveForwardInterceptor {

  public AdminAuthInterceptor() {
  }

  /**
   * beforeAction
   *
   * @param action Action
   * @param actionMapping ActionMapping
   * @param actionForm ActionForm
   * @param httpServletRequest HttpServletRequest
   * @param httpServletResponse HttpServletResponse
   * @return ActionForward
   * @throws IOException
   * @throws ServletException
   * @todo Implement this net.sf.struts.saif.ActionHaveForwardInterceptor method
   */
  public ActionForward beforeAction(Action action, ActionMapping actionMapping,
                                    ActionForm actionForm, HttpServletRequest httpServletRequest,
                                    HttpServletResponse httpServletResponse) throws IOException,
  ServletException {
      HttpSession session = httpServletRequest.getSession();
      if (session.getAttribute(Constant.USER_SESSION_KEY) == null) {
    ActionErrors errors = new ActionErrors();
    errors.add("error.timeout", new ActionMessage("error.timeout"));
    ActionUtils.addErrors(httpServletRequest, errors);
    return actionMapping.findForward("login");

  }
  return null;

  }
      /**
       * afterAction
       *
       * @param action Action
       * @param actionMapping ActionMapping
       * @param actionForm ActionForm
       * @param httpServletRequest HttpServletRequest
       * @param httpServletResponse HttpServletResponse
       * @return ActionForward
       * @throws IOException
       * @throws ServletException
       * @todo Implement this net.sf.struts.saif.ActionHaveForwardInterceptor method
       */
      public ActionForward afterAction(Action action, ActionMapping actionMapping,
                                       ActionForm actionForm, HttpServletRequest httpServletRequest,
                                       HttpServletResponse httpServletResponse) throws IOException,
  ServletException {
      return null;
  }
}

⌨️ 快捷键说明

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