package com.mandi.servlet;
|
|
import java.io.IOException;
|
|
import javax.servlet.Filter;
|
import javax.servlet.FilterChain;
|
import javax.servlet.FilterConfig;
|
import javax.servlet.ServletContext;
|
import javax.servlet.ServletException;
|
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletResponse;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
/**
|
* @author mengly
|
* @version 创建时间:2015年10月19日 下午7:31:46
|
* 类说明
|
*/
|
//@WebFilter(filterName="webinfofilter",urlPatterns={"*.jsf"})
|
public class Webinfofilter implements Filter{
|
private Logger log=Logger.getLogger(Webinfofilter.class);
|
@Override
|
public void doFilter(ServletRequest arg0, ServletResponse arg1,
|
FilterChain arg2) throws IOException, ServletException {
|
HttpServletRequest r=(HttpServletRequest)arg0;
|
HttpServletResponse re=(HttpServletResponse)arg1;
|
ServletContext sc=r.getSession().getServletContext();
|
// Webinfo wi=(Webinfo)sc.getAttribute(ConstantVar.sc_webinfo);
|
String uri=r.getRequestURI();
|
if(uri.endsWith("webinforeg.jsf"))
|
{
|
arg2.doFilter(arg0, arg1);
|
return;
|
}
|
// log.info("start to check key..."+Jacksonmethod.tojson_date(wi, true));
|
return ;
|
// if(Webinfoutil.scheckkey(wi))
|
// {
|
// log.info("check ok");
|
// arg2.doFilter(arg0, arg1);
|
// return;
|
// }else{
|
// //如果是regkey不等于null,则已经注册过,失效了
|
// if(wi.getRegkey()!=null)
|
// {
|
// //清空classes里面所有的class
|
// Webinfoutil.delclasses(this);
|
// }
|
//
|
// re.sendRedirect(r.getServletContext().getContextPath()+"/administrate/system/webinforeg.jsf");
|
// return;
|
// }
|
}
|
|
@Override
|
public void destroy() {
|
}
|
@Override
|
public void init(FilterConfig arg0) throws ServletException {
|
}
|
|
}
|