|
楼主 |
发表于 2005-4-1 21:50:07
|
显示全部楼层
- /*
- * 创建日期 2005-3-31
- *
- */
- package com.bupticet.example.struts.interceptor;
- import java.io.IOException;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
- import org.apache.struts.Globals;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.ActionMapping;
- import org.apache.struts.action.ActionMessage;
- import org.apache.struts.action.ActionMessages;
- import com.bupticet.strutsinterceptor.ActionInterceptor;
- /**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c)北京邮电大学网络教育技术研究所[[url]www.buticet.com][/url] 2005</p>
- *
- * <p>Company: 北京邮电大学网络教育技术研究所[[url]www.buticet.com][/url] </p>
- *
- * @author LJ-silver
- * @version 1.0
- */
- public class LoginPermissionInterceptor implements ActionInterceptor {
- /*
- * @see com.bupticet.strusinterceptor.ActionInterceptor#beforeAction(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- public ActionForward beforeAction(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
- HttpSession session = request.getSession();
- if(session.getAttribute(com.bupticet.example.Constants.USER_ATTRIBUTE)!=null){
- ActionMessages errors = new ActionMessages();
- errors.add(ActionMessages.GLOBAL_MESSAGE ,new ActionMessage("error.login.alreadylogin"));
- request.setAttribute(Globals.ERROR_KEY, errors);
- return mapping.findForward("failure");
- }
- return null;
- }
- /*
- * @see com.bupticet.strusinterceptor.ActionInterceptor#afterAction(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- public void afterAction(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
- }
- /*
- * @see com.bupticet.strusinterceptor.ActionInterceptor#throwsAction(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception)
- */
- public ActionForward throwsAction(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response,
- Exception e)
- throws Exception {
- return null;
- }
- }
复制代码 |
|