首页 > 其他 > 详细

AntPathMatcher做路径匹配

时间:2017-08-26 19:18:40      阅读:1045      评论:0      收藏:0      [点我收藏+]

转发自: 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;
                    }
                }
            }

 

AntPathMatcher做路径匹配

原文:http://www.cnblogs.com/yun965861480/p/7436039.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!