0

web.xml里面

    <!-- 客户端鉴权 -->
    <filter>
        <filter-name>ClientTokenFilter</filter-name>
        <filter-class>com.ustcinfo.bia.common.filter.ClientTokenFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>ClientTokenFilter</filter-name>
        <url-pattern>*.h5</url-pattern>
    </filter-mapping>
public class ClientTokenFilter implements Filter{
    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        System.out.println("进入了过滤器");
        return;
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void destroy() {
        // TODO Auto-generated method stub
        
    }
}

按ctrl是能从xml点到类里面的。但是运行的时候进不去。

顺便问一句后缀是不是写成什么都行(这里是.h5),只要匹配了就能访问?
调用的时候,直接就绕过去了,没有进入到filter里面进行验证

        $.ajax({
            url:commonObj.domain+"/h5/insertOptLogRecord.h5",
            method:"POST",
            contentType : 'application/json;charset=UTF-8',
            data:dataEncode,
            async:true,
            "success":function(optLogObj){
                window.parent.qtEntrance.PrintLog("操作记录-"+optContent+"-AJAX成功");
            },
            "error":function(XMLHttpRequest, textStatus, errorThrown){
                window.parent.qtEntrance.PrintLog("操作记录-"+optContent +"-AJAX错误");
                commonObj.saveInfo2Custom(dataEncode,"/h5/insertFaultCheck.h5");
            }
        });
2018-04-25 提问
0 个回答

撰写答案

推广链接