SpringMVC框架是一个成熟的优秀java web开发框架,学习研究框架设计有助于我们更好的理解和掌握spring MVC,设计和写出更符合的结构和代码。

本节主要是研读SpringMVC框架中的过滤器设置,以编码处理过滤器为例来学习框架内是怎样设置过滤器的。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVoAAAHRCAIAAACkROY6AAAgAElEQVR4nO2d/9MU1Z3v+0/Ib/5oRa+UJbVVSDS3tq/xulVbtcWtrWWNheFRNC5hm/hDIhY3a5GwCehzuUTNprMaMTFLNLsiJpAYDSPEUFypUIE1ITFf0GUKQXkQYZ4vwAM8z8OX9P1hevp8+5zTp2emu093v181RT3T0336dE+f15w+M+eNFwEAQBRFUeSVXQEAgCtABwCAmBx1cHDnQz/fNG/XMzfs/PYNr//rDTu+df1r37z+1W9c99Mnrzu486H89gsA6I8cdfDzTfP+fHXqz5c+vDrzX1fP/eeViV1XP3r5yth3Lh978ueb5uW3XwBAfxTVO3jqv+341vU/++Z1r37jup8++fHh9w7aoe/5YXvIpdrsNWgVvNPqUM6bMiCdvZvWrVu3bvshwzqHtptft2VY5WSks3fTuk17O8QrOergvbGJNd/e+d7J6bMX5s5emLt06dLZC7PvnZxe8+2d741NDHlnldBBO/Q9TS1bgefpi9K+2g59j8GKFpfHm6q1JVfjXpJ32QrkVQ0l5PSmxM21h9qcDm3XXOu2pctFqgUOXQfiQfVffTuK18Evf3f0yRd/+UHn4vjZmemLs9MXZ2fm5qYvznXOznzQufjki7/85e+O5rTrAsmkg3bo+z7RPrqSCAK6qPRXk+WtIGmPZMVoHdD1jyvLv8gVH7VDX6eYvBEb7KHtqhI6ezf13aC4ps92pBSYiw6SEg9tT+mcDA/Zfv3oYM+ePRs3bjSv88Jrb239xaHj4xcnp2dnZudmZueuXrk0Mzs3eW52bPzi1l8ceuG1t/rYtWNkaAzt0PfDdivQfVyai9K9Ki5vBcPSQVJb9mp3UbZq54Hy+a1+oA/gA1IHSoH56qDAe4iBdbB79+758+fPm5cyFnjwnbETnfPT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DgelZiYzHdDhSL7SjMYKXlA36kzKhDVmJjKVMH/N0df0OhW95faUUAHTDqkJXYWMrtHXDdcuXLB2p5f6XlD3TAQFYiaDjQAQPxJ6DhQAcM6AA0HOiAAR2AhgMdMKAD0HCgAwayEkHDgQ4YyEoEDQc6YLidlWj/xTo/T4GYrlITBvyhgfBz/aGfpaqeeeiA4XZWYsE6EH+xP+jFbfi9fb9k04EyAQE6oIAOGG5nJZagA2XjvhuxEzrQ7I+cDjgg0EH1cTsrEToQgQ5yADpguJ2V2OJz9ZQpytJthaoDYmYu16DUrBF6tr/wS3py0jFbzXJyrlAya+AphUtrqyV0d9DqhQKmzg5Wji69TPrk9EIiLOaVc8vowy0c6IDhfFYilU3I59jJFhCyT8S2E7TEFuH7UsiReLPNXbTsMqd3rY3uUCDn/PcyEFIK5w9JU4IQCihUQPSDLjsktUzhrRH9wJWpHggdUuFEbwI6YDidlaiLyqBDRsQ/iFQvwQetwA/b3fAjMtdI2VCqYbLrPoK9xM97/nPXtnC6BCJJJS07hFvHqkz1MPlFhtialpLRqC4pB+iA4XRWIqkDOjvLRgdJmxdF0BJijUw6IHfdnw7UVpCpcHoQYWAdZA8aFBex/oTmHHQtwW+pLika6IDhfFaiogMpx87+ZoHbyvdZVzi5ZUjXgXbX2psFfWvkbwHklm9ROFXCgDqwKVP4qpJtaAoa7J1oOaORSG0sB+iA4XZWInmzIOTYaXsH8d9KkZHQ2rjrW6qCJ48BiFGCmkhC66FEYhhNUzg/YEdHEgolZNQBf3QWZfKni61MKEY9EPJXJeqbUzzQAQNZiUOm3IQikB3ogIGsxIFpl5jzBwYHOmAgK3EIcH1suKByQAcMZCWChgMdMBB/AhoOdMCADkDDgQ4YC0YX4IFHwx/mNtIgHQAAzEAHAIAY6AAAEPP/Ad3o+9rgGyLnAAAAAElFTkSuQmCC" alt="" />

如上所示的spring-web.jar包结构所示, Spring的web包中中提供有很多过滤器,这些过滤器位于org.springframework.web.filter并且理所当然地实现了javax.servlet.Filter,

不过实现的方式有以下几类

(1) 直接实现Filter,这一类过滤器只有CompositeFilter;

(2) 继承抽象类GenericFilterBean,该类实现了javax.servlet.Filter,这一类的过滤器只有一个,即DelegatingFilterProxy;

(3) 继承抽象类OncePerRequestFilter,该类为GenericFilterBean的直接子类,这一类过滤器包括CharacterEncodingFilter、HiddenHttpMethodFilter、HttpPutFormContentFilter、RequestContextFilter和ShallowEtagHeaderFilter;

(4) 继承抽象类AbstractRequestLoggingFilter,该类为OncePerRequestFilter的直接子类,这一类过滤器包括CommonsRequestLoggingFilter、Log4jNestedDiagnosticContextFilter和ServletContextRequestLoggingFilter。

过滤器放在容器结构的什么位置?

过滤器放在web资源之前,可以在请求抵达它所应用的web资源(可以是一个Servlet、一个Jsp页面,甚至是一个HTML页面)之前截获进入的请求,并且在它返回到客户之前截获输出请求。Filter:用来拦截请求,处于客户端与被请求资源之间,目的是重用代码。Filter链,在web.xml中哪个先配置,哪个就先调用。在filter中也可以配置一些初始化参数。

Java中的Filter 并不是一个标准的Servlet ,它不能处理用户请求,也不能对客户端生成响应。 主要用于对HttpServletRequest 进行预处理,也可以对HttpServletResponse 进行后处理,是个典型的处理链。

Filter 有如下几个种类:

l  用户授权的Filter: Filter 负责检查用户请求,根据请求过滤用户非法请求。

l  日志Filter: 详细记录某些特殊的用户请求。

l  负责解码的Filter: 包括对非标准编码的请求解码。

l  能改变XML 内容的XSLTFilter 等。

Filter 有如下几个用处

l  在HttpServletRequest 到达Servlet 之前,拦截客户的HttpServletRequest 。

l  根据需要检查HttpServletRequest ,也可以修改HttpServletRequest 头和数据。

l  在HttpServletResponse 到达客户端之前,拦截HttpServletResponse 。

l  根据需要检查HttpServletResponse ,可以修改HttpServletResponse 头和数据。

创建一个Filter 只需两个步骤
(1)创建Filter 处理类:

(2)在web.xml 文件中配置Filter 。

创建Filter 必须实现javax.servlet.Filter 接口,在该接口中定义了三个方法。 
• void init(FilterConfig config): 用于完成Filter 的初始化。 
• void destroy(): 用于Filter 销毁前,完成某些资源的回收。 
• void doFilter(ServletRequest request, ServletResponse response,FilterChain
chain): 实现过滤功能,该方法就是对每个请求及响应增加的额外处理。

过滤器Filter也具有生命周期:init()->doFilter()->destroy(),由部署文件中的filter元素驱动。

参照编码过滤器示例来查看怎么实现的

  1. 首先配置在web.xml文件里的规则如下
<!-- 编码处理过滤器 -->

   <filter>

      <filter-name>encodingFilter</filter-name>

      <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

      <init-param>

         <param-name>encoding</param-name>

         <param-value>utf-8</param-value>

      </init-param>

      <init-param>

         <param-name>forceEncoding</param-name>

         <param-value>true</param-value>

      </init-param>

    </filter>

    <filter-mapping>

       <filter-name>encodingFilter</filter-name>

       <url-pattern>*.do</url-pattern>

    </filter-mapping>

其中,filter-class 为过滤器Filter类,init-prama为注入的set参数

Filter-mapping中的url-pattern为过滤的url类型

类的继承关系

CharacterEncodingFilter r类继承了 OncePerRequestFilter

public class CharacterEncodingFilter extends OncePerRequestFilter

 

OncePerRequestFilter 类又继承了GenericFilterBean

public abstract class OncePerRequestFilter extends GenericFilterBean

 

public abstract class GenericFilterBean implements

       Filter, BeanNameAware, EnvironmentAware, ServletContextAware, InitializingBean, DisposableBean

 

 

设置编码的核心代码为

@Override

   protected void doFilterInternal(

         HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)

         throws ServletException, IOException {

      if (this.encoding != null && (this.forceEncoding || request.getCharacterEncoding() == null)) {

         request.setCharacterEncoding(this.encoding);

         if (this.forceEncoding) {

            response.setCharacterEncoding(this.encoding);

         }

      }

      filterChain.doFilter(request, response);

   }

其中filterChain为过滤器链,表示执行完这个过滤器之后接着执行下一个过滤器

区别

我们在使用过滤器时,通常没必要知道GenericFilterBean、OncePerRequestFilter和AbstractRequestLoggingFilter,但不防碍我们了解这几个类,就上文所述,AbstractRequestLoggingFilter继承自OncePerRequestFilter,OncePerRequestFilter继承自GenericFilterBean,所以我们知道,genericFilterBean是任何类型的过滤器的一个比较方便的超类,这个类主要实现的就是从web.xml文件中取得init-param中设定的值,然后对Filter进行初始化(当然,其子类可以覆盖init方法)。

OncePerRequestFilter继承自GenericFilterBean,那么它自然知道怎么去获取配置文件中的属性及其值,所以其重点不在于取值,而在于确保在接收到一个request后,每个filter只执行一次,它的子类只需要关注Filter的具体实现即doFilterInternal。

AbstractRequestLoggingFilter是对OncePerRequestFilter的扩展,它除了遗传了其父类及祖先类的所有功能外,还在doFilterInternal中决定了在过滤之前和之后执行的事件,它的子类关注的是beforeRequest和afterRequest。

总体来说,这三个类分别执行了Filter的某部分功能,当然,具体如何执行由它们的子类规定,若你需要实现自己的过滤器,也可以根据上文所述继承你所需要的类。

SpringMVC 过滤器Filter使用解析的更多相关文章

  1. spring mvc过滤器filter

    SpringMVC 过滤器Filter使用解析 1.如上所示的spring-web.jar包结构所示, Spring的web包中中提供有很多过滤器,这些过滤器位于org.springframework ...

  2. java 过滤器(Filter)与springMVC 拦截器(interceptor)的实现案例

    java 过滤器Filter: package com.sun.test.aircraft.filter;import javax.servlet.*;import java.io.IOExcepti ...

  3. SpringBoot系列教程web篇之过滤器Filter使用指南

    web三大组件之一Filter,可以说是很多小伙伴学习java web时最早接触的知识点了,然而学得早不代表就用得多.基本上,如果不是让你从0到1写一个web应用(或者说即便从0到1写一个web应用) ...

  4. SpringMVC 源码深度解析&lt;context:component-scan&gt;(扫描和注冊的注解Bean)

    我们在SpringMVC开发项目中,有的用注解和XML配置Bean,这两种都各有自己的优势,数据源配置比較经经常使用XML配置.控制层依赖的service比較经经常使用注解等(在部署时比較不会改变的) ...

  5. java springmvc Log4j filter等(稍微完善一下项目)

    仅供参考-接上文 springmvc  1.设置Log4jConfigListener日志监听(可以为开发调试.发布后运行的意外调试.等) 在src/main/resources目录下新建log4j. ...

  6. 过滤器(Filter)和拦截器(Interceptor)

    过滤器(Filter) Servlet中的过滤器Filter是实现了javax.servlet.Filter接口的服务器端程序.它依赖于servlet容器,在实现上,基于函数回调,它可以对几乎所有请求 ...

  7. 一、变量.二、过滤器(filter).三、标签(tag).四、条件分支tag.五、迭代器tag.六、自定义过滤器与标签.七、全系统过滤器(了解)

    一.变量 ''' 1.视图函数可以通过两种方式将变量传递给模板页面 -- render(request, 'test_page.html', {'变量key1': '变量值1', ..., '变量ke ...

  8. SpringMVC 过滤器

    参考: http://qq-22530757.iteye.com/blog/2177513 http://www.jdon.com/dl/best/spring-security.html https ...

  9. SpringBoot系列教程web篇之过滤器Filter使用指南扩展篇

    前面一篇博文介绍了在 SpringBoot 中使用 Filter 的两种使用方式,这里介绍另外一种直接将 Filter 当做 Spring 的 Bean 来使用的方式,并且在这种使用方式下,Filte ...

随机推荐

  1. $python虚拟化运行环境——virtualenv

    介绍 virtualenv是一种虚拟化环境,可以理解为创建了一个虚拟化的pyhon运行空间,可以从新安装各种库,而与本机环境互不影响,互相隔离. 安装及使用 首先要安装包管理工具pip(pip的使用详 ...

  2. c语言的按位运算符

    & 按位与 | 按位或 ^ 按位异或 1. 按位与运算 按位与运算符"&"是双目运算符.其功能是参与运算的两数各对应的二进位相与.只有对应的两个二进位均为1时,结果 ...

  3. Git和GitHub相关

    组员从GitHub上下载项目并上传项目的步骤如下 .组员接收到组长发的项目地址,组员需要从GitHub上把项目克隆下来,首先组员 需要在本地的一个文件夹里打开git,然后运行如下代码:git clon ...

  4. File类之常用方法

    package IoDemo; import java.io.File; import java.io.IOException; /** * @Title:FileTest * @Descriptio ...

  5. C++ 进阶学习 ——模板

    模板和重载类似,比重载更省事 通常有两种形式:函数模板和类模板: 函数模板针对仅参数类型不同的函数: 类模板针对仅数据成员和成员函数类型不同的类. 一个简单的函数模板 template <cla ...

  6. 清除微信浏览器网址的缓存,cookie

    清理微信浏览网站的缓存,Cookie http://blog.csdn.net/cui55/article/details/53939462 怎么清除IOS微信浏览器中的cookie? 退出微信重新登 ...

  7. android6.0、7.0、8.0新特性总结之开发应用时加以考虑的一些主要变更。

    android6.0 参考一:简书Android 6.0 新特性详解 参考二:关于Android6.0以上系统的权限问题 参考三:值得你关注的Android6.0上的重要变化(一) 参考四:值得你关注 ...

  8. linux的find命令详解

    find命令是用来在给定的目录下查找符合给定条件的文件 find [OPTIONS] [查找起始路径] [查找条件] [处理动作]   一.OPTIONS参数 -P.-L.-H:控制软连接的对待方式, ...

  9. 设置Qt程序在Windows开机后自动运行

    (转自:http://blog.csdn.net/weiren2006/article/details/7443362) 主要原理是修改Windows的注册表来实现的,Qt的QSettings提供了访 ...

  10. .NET中 数据库连接

    (转自:http://www.iwms.net/n459c12.aspx) SQL Server ODBC  Standard Security:"Driver={SQL Server};S ...