authorityinterceptor.java.svn-base

来自「学习dwr+struts2+spring进行开发的好例子」· SVN-BASE 代码 · 共 27 行

SVN-BASE
27
字号
package com.szhelper.lotteryWeb.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.szhelper.lotteryWeb.Constants;

public class AuthorityInterceptor extends AbstractInterceptor {
	private static final long serialVersionUID = 1358600090729208361L;

	// 9��Action�����9�ط���
	public String intercept(ActionInvocation invocation) throws Exception {
		// ȡ��������ص�ActionContextʵ��
		ActionContext ctx = invocation.getInvocationContext();
		Map session = ctx.getSession();
		String loginFlag = (String) session.get(Constants.LOGIN_FLAG);
		if (loginFlag != null) {
			return invocation.invoke();
		}

		ctx.put(Constants.LOGIN_TIP, Constants.LOGIN_TIP);
		return Action.LOGIN;
	}
}

⌨️ 快捷键说明

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