import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; 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.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.alibaba.fastjson.JSON; import com.viewalloc.base.common.model.contants.ResultCodeType; import com.viewalloc.base.common.model.dto.InvokeResult; import com.viewalloc.base.common.redis.VARedisTemplate; import com.viewalloc.scan.admin.common.utils.CookieUtils; public class LoginFilter implements Filter { private WebApplicationContext wac; private Logger log = LoggerFactory.getLogger(this.getClass()); @Override public void destroy() { } private static final String[] NO_FILTER_URL = new String[]{"/api/user/session","/api/user/logout","login.html","/api/version"}; @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { VARedisTemplate redis = wac.getBean(VARedisTemplate.class); } @Override public void init(FilterConfig arg0) throws ServletException { wac = (WebApplicationContext) arg0.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); } }