修改web.xml添加过滤器配置
其中servlet-name为flex.messaging.MessageBrokerServlet的servlet-name
FlexFilter类,和其它Filter类一样
package org.liuchang.filter; 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; public class FlexFilter implements Filter{ @Override public void destroy() { // TODO Auto-generated method stub } @Override public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { System.out.println("FlexFilter.doFilter"); } @Override public void init(FilterConfig arg0) throws ServletException { // TODO Auto-generated method stub } }
在doFilter中可以获取session对用户做权限的校验等操作。