?? datacontrolinterceptor.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 + -