📄 securityinterceptor.java
字号:
package com.easyjf.web.interceptor.security;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.easyjf.web.WebForm;
import com.easyjf.web.interceptor.AbstractPreActionInterceptor;
import com.easyjf.web.interceptor.InterceptorException;
public class SecurityInterceptor extends AbstractPreActionInterceptor {
private ISecurityManager securityManager;
public ISecurityManager getSecurityManager() {
return securityManager;
}
public void setSecurityManager(ISecurityManager securityManager) {
this.securityManager = securityManager;
}
protected boolean doPreInterception(HttpServletRequest request,
HttpServletResponse response, WebForm form)
throws InterceptorException {
if (this.getSecurityManager() == null) {
try{
this.setSecurityManager(new PropertiesSecurityManager());
}
catch(SecurityException e)
{
}
}
try {
List conditions = this.getSecurityManager().findCondition(request,
response);
for (Iterator it = conditions.iterator(); it.hasNext();) {
ICondition condition = (ICondition) it.next();
if (condition != null) {
boolean ret = condition.doCheck(request, response);
if (!ret) {
return false;
}
}
}
} catch (SecurityException ex) {
throw new InterceptorException(this.getClass().getName()
+ " cause error : " + ex.getInfo());
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -