Shiro_DelegatingFilterProxy
1.DelegatingFilterProxy实际上是Filter的一个代理对象。默认情况下,Spring会到IOC容器中查找与<filter-name>对应的filter bean。也可以通过targetBeanName的初始化参数来配置bean的id。
2.配置shiroFilter
--id必须和web.xml文件中配置的DelegatingFilterProxy的<filter-name>一致。为什么?(看下文)
--若不一致,则会抛出异常。因为Shiro会来IOC容器寻找与<filter-name>名字对应的filter Bean。
(1)查看org.springframework.web.filter.DelegatingFilterProxy的源码,


/**
* Return the name of the ServletContext attribute which should be used to retrieve the
* {@link WebApplicationContext} from which to load the delegate {@link Filter} bean.
*/
public String getContextAttribute() {
return this.contextAttribute;
}
/**
* Set the name of the target bean in the Spring application context.
* The target bean must implement the standard Servlet Filter interface.
* <p>By default, the {@code filter-name} as specified for the
* DelegatingFilterProxy in {@code web.xml} will be used.
*/
public void setTargetBeanName(String targetBeanName) {
this.targetBeanName = targetBeanName;
}
(2)做以下调整,
web.xml:

applicationContext.xml:

结果:可以正常运行。
Shiro_DelegatingFilterProxy的更多相关文章
- 配置ShiroFilter需要注意的问题(Shiro_DelegatingFilterProxy)
ShiroFilter的工作原理 ShiroFilter:DelegatingFilterProxy作用是自动到Spring 容器查找名字为shiroFilter(filter-name)的bean并 ...
随机推荐
- 基于PHP自带的mail函数实现发送邮件以及带有附件的邮件功能
PHPmail函数简介 bool mail ( string $to , string $subject , string $message [, string $additional_headers ...
- Commons-FileUpload 常用API
ServerFileUpload类的常用方法 方法名称 方法描述 public void setSizeMax(long sizeMax) 设置请求信息实体内容的最大允许的字节数 public Lis ...
- Java多线程(三)SimpleDateFormat
多线程报错:java.lang.NumberFormatException: multiple points SimpleDateFormat是非线程安全的,在多线程情况下会有问题,在每个线程下得各自 ...
- 网站开发综合技术 第一部分HTML 1.3.2表单
<form id="" name="" method="post/get" action="负责处理的服务端"&g ...
- .net 反射初体验
一.获取对象中的所有属性 Type是.net定义的一个反射的类.通过反射获取到对象的所有属性,然后根据属性获取对象对应属性所对应的值. 使用PropertyInfo,请引用命名空间using Syst ...
- datagrid上面的查询按钮设置了,但是分页工具栏不显示
原因:查询的linkbutton没有放在toolbar里. <script type="text/javascript"> $(function(){ $('#dg') ...
- 微信小程序一些常见的坑
1.小程序都报wxss编译错误 解决方法: 在控制台输入openVendor() ,清除里面的wcsc wcsc.exe 然后重启工具 2.微信小程序wx:for警告 Now you can prov ...
- LR接口测试---Java Vuser之jdbc查询(调试前)
在eclipse下编写好的代码: import lrapi.lr; import java.sql.Connection; import java.sql.DriverManager; import ...
- [转帖]关于flask-login中各种API使用实例
原贴:http://www.cnblogs.com/alima/p/5796298.html 简介:简单的集成flask,WTForms,包括跨站请求伪造(CSRF),文件上传和验证码. 一.安装(I ...
- 分析器错误消息: 该配置节不能包含 CDATA 或文本元素。
原因当然是web.config配置文件中,有字符串文本了,估计不小心加上的一些字符,所以会报错,去掉就行,例如13行的s