zoukankan      html  css  js  c++  java
  • AntPathMatcher做路径匹配

    转发自: http://www.cnblogs.com/leftthen/p/5212221.html

    需要看详细的请看上面的链接

    这里以我这里的一个Filter 中需要对路径做例外处理,filter配置如下

    <bean id="adminOnlineUserFilter" class="com.midea.finance.framework.authority.filter.AdminOnlineUserFilter">
            <property name="mdpOnllineUserService" ref="mdpOnllineUserDubboServiceClient"></property>
            <property name="logoutLink" value="${mdp.security.loginOutUrl}"></property>
            <property name="sysFlag" value="${bizSys}"></property>
            <property name="passedPaths">
                <list>
                    <value>/resources/**</value>
                </list>
            </property>
        </bean>

    这里的 

    passedPaths 是例外配置的路径,接收为一个 Stirng []
    对例外的处理
    String requestPath = req.getServletPath();
                // 路径过滤
                PathMatcher matcher = new AntPathMatcher();
                if( passedPaths != null ) {
                    boolean flag;
                    for( String passedPath : passedPaths ) {
                        flag = matcher.match( passedPath, requestPath );
                        if( flag ) {
                            logger.info( "AdminOnlineUserFilter source '" + requestPath + "'is matched,filter chain will be continued." );
                            chain.doFilter( request, response );
                            return;
                        }
                    }
                }
  • 相关阅读:
    读取Java文件到byte数组的三种方式
    https://blog.csdn.net/eguid_1/article/category/6270094
    JavaCV 学习(一):JavaCV 初体验
    WebService服务发布与使用(JDK自带WebService)
    SourceTree 免登录跳过初始设置
    Owin password
    IIS并发
    压力测试
    nginx
    消息队列MSMQ
  • 原文地址:https://www.cnblogs.com/yun965861480/p/7436039.html
Copyright © 2011-2022 走看看