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并 ...
随机推荐
- Linux 用户管理(2)
Linux 用户管理2 添加修改和删除用户,必须是超级管理员root账号才可以进行的操作,所以当当前账号不是超级管理员root账号时,首先要先切换为root账号. 如图,ylq为普通用户,执行添加用户 ...
- mysql-5.7.20基本用法
第1章 安装mysql-5.7.20 1.1 系统环境 [root@mysql ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (C ...
- Java多线程(四)isAlive
isAlive 活动状态:线程处于正在运行或准备开始运行的状态 public class ISLiveDemo extends Thread { public void run() { System. ...
- Glide和Picassio的比较
http://blog.csdn.net/fancylovejava/article/details/44747759 对象池: Glide原理的核心是为bitmap维护一个对象池.对象池的主要目的是 ...
- RHEL5.6环境下yum安装MySQL
RHEL5.6环境下yum安装MySQL记录,2017年2月20日 1.卸载原有的MySQL rpm -qa命令查询是否安装了MySQL [root@localhost mysql]# rpm -qa ...
- ora-00600 to check
Hi , Let us know issue reproducibility executing following statement from command prompt: SELECT &qu ...
- ASP.NET GridView 控件绑定 CheckBoxList
需求:设计这样一个页面,在页面上可以自由选择和展示各省份下城市? 思路:一次性查询出所需的记录(查询数据库的操作不宜写到 C# 代码的循环语句中),并保存到全局变量中,之后根据条件过滤出需要的.可以在 ...
- Spark学习笔记1:Application,Driver,Job,Task,Stage理解
看了spark的原始论文和相关资料,对spark中的一些经常用到的术语做了一些梳理,记录下. 1,Application application(应用)其实就是用spark-submit提交的程序.比 ...
- 创建http对象
package test; import java.net.HttpURLConnection;import java.net.URL; import javax.servlet.http.HttpS ...
- Assembly之instruction之Status register
The status register (SR/R2), used as a source or destination register, can be used in the register m ...