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

📄 datacontrolinterceptor.java

📁 JAVA内容管理系统JAVA内容管理系统JAVA内容管理系统JAVA内容管理系统
💻 JAVA
字号:
package com.ponyjava.common.struts2.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil;

@SuppressWarnings("serial")
public class DataControlInterceptor extends MethodFilterInterceptor {
	private static final Logger log = LoggerFactory
			.getLogger(DataControlInterceptor.class);
	private final static String PREFIX = "control";
	private final static String PREFIX_ALT = "controlDo";

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		Object action = invocation.getAction();

		if (action instanceof DataControlAware) {
			try {
				PrefixMethodInvocationUtil.invokePrefixMethod(invocation,
						new String[] { PREFIX, PREFIX_ALT });
			} catch (DataAccessException e) {
				log.warn("数据不允许访问!");
				throw e;
			} catch (Exception e) {
				throw e;
			}
		}
		return invocation.invoke();
	}
}

⌨️ 快捷键说明

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