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

📄 mgrauthorityinterceptor.java

📁 简单工作流系统。采用Struts+hibernate+spring实现。
💻 JAVA
字号:
package org.yeeku.struts.authority;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author  yeeku.H.lee kongyeeku@163.com
 * @version  1.0
 * <br>Copyright (C), 2005-2008, yeeku.H.Lee
 * <br>This program is protected by copyright laws.
 * <br>Program Name:
 * <br>Date: 
 */
public class MgrAuthorityInterceptor implements MethodInterceptor
{

    public Object invoke(MethodInvocation invocation) throws Throwable
	{
        HttpServletRequest request = null;
        ActionMapping mapping = null;
        Object[] args = invocation.getArguments();
        for (int i = 0 ; i < args.length ; i++ )
        {
            if (args[i] instanceof HttpServletRequest) request = (HttpServletRequest)args[i];
            if (args[i] instanceof ActionMapping) mapping = (ActionMapping)args[i];
        }
        String level = (String)request.getSession().getAttribute("level");
        if ( level != null && level.equals("mgr") )
        {
            return invocation.proceed();
        }
        else
        {
            return mapping.findForward("login");
        }
    }
}

⌨️ 快捷键说明

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