org.springframework.web.filter.DelegatingFilterProxy的理解
org.springframework.web.filter.DelegatingFilterProxy可以将filter交给spring管理。
我们web.xml中配置filter时一般采用下面这种方式:
<filter>
<filter-name>myFilter</filter-name>
<filter-class>com.chaokuzx.myFilter</filter-class>
</filter>
因为一个filter也就是一个servlet,所以myFilter就会交给servlet容器(tomcat)去初始化和销毁。如果我们配置了spring就希望spring可以帮我们管理bean,
myFilter也可以被看做是一个bean。当我们需要spring去管理myFilter,又需要myFilter去实现它作为filter的功能时可以使用
org.springframework.web.filter.DelegatingFilterProxy将filter代理给spring。
配置如下:
<!-- web.xml --> <filter>
<filter-name>myfilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter> <!-- spring --> <bean id=”myFilter” class=”com.chaokuzx.myFilter”></bean> <!-- 或用注解的方式 -->
当用户的请求被myfilter拦截后,org.springframework.web.filter.DelegatingFilterProxy容器中寻找名为myfilter的类来拦截用户的请求
org.springframework.web.filter.DelegatingFilterProxy的理解的更多相关文章
- org.springframework.web.filter.DelegatingFilterProxy的作用
一.类结构 DelegatingFilterProxy类继承GenericFilterBean,间接实现了Filter,故而该类属于一个过滤器.那么就会有实现Filter中init.doFilter. ...
- Spring管理过滤器:org.springframework.web.filter.DelegatingFilterProxy
配置web.xml <filter> <filter-name>springSecurityFilterChain</filter-name> ...
- java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter
今天在用git merge 新代码后报了如下错误:java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterE ...
- org.springframework.web.filter.CharacterEncodingFilter
感谢:http://blog.csdn.net/heidan2006/article/details/3075730 很简单很实用的一个过滤器,当前台JSP页面和JAVA代码中使用了不同的字符集进行编 ...
- 通过org.springframework.web.filter.CharacterEncodingFilter定义Spring web请求的编码
通过类org.springframework.web.filter.CharacterEncodingFilter,定义request和response的编码.具体做法是,在web.xml中定义一个F ...
- java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter
java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast ...
- SpringMVC(四):@RequestMapping结合org.springframework.web.filter.HiddenHttpMethodFilter实现REST请求
1)REST具体表现: --- /account/1 HTTP GET 获取id=1的account --- /account/1 HTTP DELETE 删除id=1的account ...
- Caused by: java.lang.ClassNotFoundException: org.springframework.web.filter.FormContentFilter
又是一个报错,我写代码真的是可以,所有的bug都会被我遇到,所有的问题我都能踩一遍,以前上学的时候同学就喜欢问我问题,因为他们遇到的问题,我早就遇到了......... 看看报错内容: 2019-04 ...
- SpringMVC------报错:java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter
详细信息: java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter 严重: E ...
随机推荐
- uva 10105
数学 杨辉三角 多项式系数 #include <cstdio> int f[13] = {1}; void init() { for (int i = 1; i < 13; i+ ...
- python调试总结
调试通常采用两种方式,打印日志调试以及运行时实时跟踪调试. 一.打印日志: 1. print不要看不起print,这是一切调试的起点,即便是调试Java或者C这种巨麻烦的编译语言,print仍然是常用 ...
- 【leetcode】Divide Two Integers (middle)☆
Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...
- poj 2100 Graveyard Design
直接枚举就行了 #include<iostream> #include<stdio.h> #include<algorithm> #include<ioman ...
- linux Ubuntu安装后没有引导 解决方案
用EasyBCD添加ubuntu grub2引导,适用于12.04 及之前版本的ubuntu安装好easybcd后运行,之后看图
- PowerDesigner将name自动添加到Comment注释的方法 VB代码
Option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl ' the current model ' get t ...
- EntityFreamWork和Mvc 精品知识点
定义了DbRepository<TEntity>:IRepository<TEntity> ,SimpleDbContext继承了DbContext, UnitOfWork:I ...
- 【POJ 3335】 Rotating Scoreboard (多边形的核- - 半平面交应用)
Rotating Scoreboard Description This year, ACM/ICPC World finals will be held in a hall in form of a ...
- JS 封装类
function HighchartsObj(id, type) { var that = this; this.options = { chart : { renderTo : id, type : ...
- Android 自定义android控件EditText边框背景
在我们进行Android应用界面设计和时候,为了界面风格的统一,我们需要对一些控件进行自定义.比如我们的应用采用的蓝色风格,但是 android的EditText控制获得焦点后显示的却是黄色的边框背景 ...