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并 ...
随机推荐
- E20170610-hm
presence n. 出席; 仪表; 风度; 鬼魂,神灵; defence n. 防御; 辩护; 防御工事; 后卫; phyle n. 种族,宗族; race n. 赛跑; 民族; 人种; ...
- Avito Code Challenge 2018 A~E
A. Antipalindrome 还以为是什么神dp结果就是分情况讨论啊 原串是一串一样的字符的话输出0,是回文串的话输出n-1,否则直接输出原串长度 #include<iostream> ...
- P3297 [SDOI2013]逃考
传送门 完全看不出这思路是怎么来的-- 首先对于两个亲戚,他们监视范围的边界是他们连线的中垂线.那么对于一个亲戚来说它能监视的范围就是所有的中垂线形成的半平面交 然后如果某两个亲戚的监视范围有公共边, ...
- Springboot 三种拦截Rest API的方法-过滤器、拦截器、切片
过滤器方式实现拦截(Filter) 通过继承Servlet的Filter类来实现拦截: @Component public class TimeFilter implements Filter { @ ...
- magento 翻译使用实例
在自定义的模块中若想要使用翻译,需在config.xml中加入如下配置 <config> <adminhtml> //后台 <translate> <modu ...
- ASP.NET中的<%%>介绍
一.主要用于ASP.NET前台绑定用的最多: <%#Eval("")%> <%#Bind("")%> <%=变量%> 1.& ...
- Farseer.net轻量级开源框架 中级篇:自定义配置文件
导航 目 录:Farseer.net轻量级开源框架 目录 上一篇:Farseer.net轻量级开源框架 中级篇: 数据绑定 下一篇:Farseer.net轻量级开源框架 中级篇: 动态数据库访问 ...
- 语义分割:使用关系图辅助图像分割-Capsule Network、IceNet
文章:欲取代CNN的Capsule Network究竟是什么来头?它能为AI界带来革命性转折么? 文章:用于分类.检测和分割的移动网络 MobileNetV2 网络 文章:后RCNN时代的物体检测及分 ...
- UI开发模式-容器模式
UI开发模式-容器模式 通用容器: 配置容器.
- Linux 报错 ifconfig command not found
1.Linux 中输入ifconfig命令报错:ifconfig command not found 有可能是没有安装ifconfig,如果没有,安装上去 2.查看是不是缺少了ifconfig,它是在 ...