zoukankan      html  css  js  c++  java
  • 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的源码,

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

    (2)做以下调整,

    web.xml:

    applicationContext.xml:

    结果:可以正常运行。

    每接触一个新领域,我就像一块掉进水里的海绵,四面八方的养分都让我不断充实。O(∩_∩)O~
  • 相关阅读:
    HTML5和CSS3的学习视频
    webpack中bundler源码编写2
    webpack中bundler源码编写
    webpack中如何编写一个plugin
    webpack多页面打包配置
    webpack中配置eslint
    webpack解决单页面路由问题
    webpack中使用WebpackDevServer实现请求转发
    webpack中typeScript的打包配置
    rsync 同步
  • 原文地址:https://www.cnblogs.com/zhzcode/p/9682187.html
Copyright © 2011-2022 走看看