实现/*

    /**
* 根据当前的URL返回该url的角色集合。
* 1.如果当前的URL在匿名访问的URL集合当中时,在当前的角色中添加匿名访问的角色(SysRole.ROLE_CONFIG_ANONYMOUS)。
* 2.如果当前系统不存在的情况,给当前用户添加一个公共访问的角色(SysRole.ROLE_CONFIG_PUBLIC)。 3.url
* 和角色映射,url和参数映射,给当前用户添加一个公共的角色(SysRole.ROLE_CONFIG_PUBLIC)。
*
* @param object the object
* @return the attributes
*/
public Collection<ConfigAttribute> getAttributes(Object object) {
LOGGER.info("Enter");
Collection<ConfigAttribute> configAttribute = new HashSet<ConfigAttribute>();
FilterInvocation filterInvocation = (FilterInvocation) object;
HttpServletRequest request = filterInvocation.getRequest();
String url = request.getRequestURI();
LOGGER.info("FullUrl="+filterInvocation.getFullRequestUrl());
LOGGER.info("URL="+filterInvocation.getRequestUrl());
LOGGER.info("URI="+request.getRequestURI());
LOGGER.info("CTX="+filterInvocation.getHttpRequest().getContextPath());
String urlNoCtx = removeCtx(url, request.getContextPath());
// 匿名访问的URL
if (anonymousUrls.contains(urlNoCtx)) {
configAttribute.add(RoleConstant.ROLE_ANONYMOUS);
return configAttribute;
}else{
//2016年7月28日15:18:27 匿名访问的匹配规则的实现
for(String anonymouseUrl : anonymousUrls){
if(anonymouseUrl.indexOf("*") > -1){
anonymouseUrl = anonymouseUrl.replace("*",".*");
if(urlNoCtx.matches(anonymouseUrl)){
configAttribute.add(RoleConstant.ROLE_ANONYMOUS);
return configAttribute;
}
}
}
if(urlNoCtx.contains("lms")){
configAttribute.add(RoleConstant.ROLE_LMS_ANONYMOUS);
}else{
configAttribute.add(RoleConstant.ROLE_PUBLIC);
}
}
return configAttribute;
}

在JaveWeb项目中配置Spring 匿名访问时,匹配规则的变相实现/*的更多相关文章

  1. 如何在web项目中配置Spring的Ioc容器

    在web项目中配置Spring的Ioc容器其实就是创建web应用的上下文(WebApplicationContext) 自定义要使用的IoC容器而不使用默认的XmlApplicationContext ...

  2. 如何在Web项目中配置Spring MVC

    要使用Spring MVC需要在Web项目配置文件中web.xml中配置Spring MVC的前端控制器DispatchServlet <servlet> <servlet-name ...

  3. web项目中 集合Spring&使用junit4测试Spring

    web项目中 集合Spring 问题: 如果将 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(& ...

  4. 06_在web项目中集成Spring

    在web项目中集成Spring 一.使用Servlet进行集成测试 1.直接在Servlet 加载Spring 配置文件 ApplicationContext applicationContext = ...

  5. eclipse中配置spring环境

    初识Spring框架 1.简单使用 eclipse中配置Spring环境,如果是初学的话,只需要在eclipse中引入几个jar包就可以用了, 在普通java project项目目录下,建一个lib文 ...

  6. 在maven项目中 配置代理对象远程调用crm

    1 在maven项目中配置代理对象远程调用crm 1.1 在项目的pom.xml中引入CXF的依赖 <dependency> <groupId>org.apache.cxf&l ...

  7. 如何在maven项目中使用spring

    今天开始在maven项目下加入spring. 边学习边截图. 在这个过程中我新建了一个hellospring的项目.于是乎从这个项目出发开始研究如何在maven项目中使用spring.鉴于网上的学习资 ...

  8. web项目中配置多个数据源

    web项目中配置多个数据源 spring + mybatis 多数据源配置有两种解决方案 1.配置多个不同的数据源,使用一个sessionFactory,在业务逻辑使用的时候自动切换到不同的数据源,  ...

  9. Spring-Boot项目中配置redis注解缓存

    Spring-Boot项目中配置redis注解缓存 在pom中添加redis缓存支持依赖 <dependency> <groupId>org.springframework.b ...

随机推荐

  1. jQuery.ajaxComplete() 函数详解

    ajaxComplete()函数用于设置当AJAX请求完成(无论成功或失败)时执行的回调函数. 这是一个全局AJAX事件函数,用于为所有AJAX请求的ajaxComplete事件绑定事件处理函数.当A ...

  2. hibernate关联映射

    首先,建立user表,news表 建立User,News类 package com.example.hibernate; import java.util.Set; public class User ...

  3. ngx_http_fastcgi_module模块.md

    ngx_http_fastcgi_module ngx_http_fastcgi_module模块允许将请求传递到FastCGI服务器. fastcgi_bind Syntax: fastcgi_bi ...

  4. Multiply Strings

    Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...

  5. [LeetCode] Lexicographical Numbers 字典顺序的数字

    Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,1 ...

  6. [LeetCode] Combination Sum II 组合之和之二

    Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in ...

  7. 如何理解 卷积 和pooling

    转自:http://blog.csdn.net/malefactor/article/details/51078135 CNN是目前自然语言处理中和RNN并驾齐驱的两种最常见的深度学习模型.图1展示了 ...

  8. JQuery选择器

    动态修改样式 $("#div1").attr("display","block"); //有问题 $("#div1"). ...

  9. html&css复习题(参考答案)

    1. 常用的块属性标签及特征有哪些? 常用块标签:Div  h1~ h6  ol ul li  dl td dd  table tr th td  p  br  form 块标签特征:独占一行,换行显 ...

  10. vue-resource初体验

    这个插件是用于http请求的,类似于jquery的ajax函数,支持多种http方法和jsonp. 下面是resource支持的http方法. get: {method: 'GET'},save: { ...