一、什么是过滤器

  过滤器filter是JavaWeb三大组件之一,它与Servlet很相似!不过过滤器是用来拦截请求的,而不是处理请求的。WEB开发人员通过Filter技术,对web服务器管理的所有web资源:例如Jsp, Servlet, 静态图片文件或静态 html 文件等进行拦截,从而实现一些特殊的功能。例如实现URL级别的权限访问控制、过滤敏感词汇、压缩响应信息等一些高级功能。

  Servlet API中提供了一个Filter接口,开发web应用时,如果编写的Java类实现了这个接口,则把这个java类称之为过滤器Filter。通过Filter技术,开发人员可以实现用户在访问某个目标资源之前,对访问的请求和响应进行拦截,如下所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA3cAAADxCAIAAADnUNkZAAAgAElEQVR4nO2dd1xTZ/vG81pHFWVPcSC4cKSKW3DVhaNSo1CtE9yCKEatE8U9UVDAOlt968BW0Fatew8gtLVvlz9ra+2yrW2x1TqA9PcHEE6Sk50895NwfT/XHy2Glfsi55szniP5FwAAAAAAAGsjof4BAAAAAACAAwLLBAAAAAAA1qfcMu8/eiQBHEDYhooD9ZBBKdRFAAAAYEPKX+Vv/vKLRCLJyFcgVDl391tsd9mAqpPnyvf30HYAAHBsYJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywzApIYWHhrVu3srKyVq5cOXnKlFciItq0b1+/QQMfPz9Xd/fqNWpUr17dxc3Nx8+vXkDASyEh4QMGjJ8wISkp6cCBAzdv3nzy5An1bwCAPh48eHDlypWdO3fOnz9/THR07/BwaevW9QICfPz8XNzcqteoUe3FF51dXDy9vf3r1Qtu3rx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OmTp03b15KSsqBAwfOnz9/9+5dOzrV0iRgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweGCZHAWWyQxUnTywTAAAcHhgmRwFlskMVJ08sEwAAHB4YJkcBZbJDFSdPLBMAABweMpf5X97/FgCOICwDRUH6iGDUqiLAAAAwIbgVR4AAAAAAFgfWCYAAAAAALA+sEwAAAAAAGB9/h95jxaqbfZR0wAAAABJRU5ErkJggg==" alt="" />

二、Filter是如何实现拦截的?

  Filter接口中有一个doFilter方法,当我们编写好Filter,并配置对哪个web资源进行拦截后,WEB服务器每次在调用web资源的service方法之前,都会先调用一下filter的doFilter方法,因此,在该方法内编写代码可达到如下目的:

  1. 调用目标资源之前,让一段代码执行。
  2. 是否调用目标资源(即是否让用户访问web资源)。
  3. 调用目标资源之后,让一段代码执行。

  web服务器在调用doFilter方法时,会传递一个filterChain对象进来,filterChain对象是filter接口中最重要的一个对 象,它也提供了一个doFilter方法,开发人员可以根据需求决定是否调用此方法,调用该方法,则web服务器就会调用web资源的service方 法,即web资源就会被访问,否则web资源不会被访问。

三、Filter开发入门

  第一步:写一个类实现Filter接口

public class HelloFilter implements Filter {
/**
* 创建之后马上执行,用来做初始化
*/
@Override
public void init(FilterConfig filterConfig) throws ServletException { } /**
* 每次过滤时都会执行
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
System.out.println("AFilter#start");
chain.doFilter(request, response);
System.out.println("AFilter#end");
} /**
* 销毁之前执行,用来对非内存资源进行释放
*/
@Override
public void destroy() { }
}

  第二步:在web.xml中进行配置

<filter>
<filter-name>helloFilter</filter-name>
<filter-class>cn.itcast.filter.HelloFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>helloFilter</filter-name>
<!--指定要拦截的路径,当用户访问index.jsp页面时,HelloFilter就会被执行-->
<url-pattern>/index.jsp</url-pattern>
</filter-mapping>

四、Filter的生命周期

【Filter的创建】——init(FilterConfig):

  Filter的创建和销毁由WEB服务器负责。 web 应用程序启动时,web 服务器将创建Filter 的实例对象,并调用其init方法,完成对象的初始化功能,从而为后续的用户请求作好拦截的准备工作filter对象只会创建一次,init方法也只会执行一次。通过init方法的参数,可获得代表当前filter配置信息的FilterConfig对象。

【Filter的销毁】——destroy()

  服务器会在创建Filter对象之后,把Filter放到缓存中一直使用,通常不会销毁它。一般会在服务器关闭时销毁Filter对象,在销毁Filter对象之前,服务器会调用Filter对象的destory()方法。

【doFilter方法】

  doFilter(ServletRequest req,ServletResponse res,FilterChain chain):这个方法会在用户每次访问“目标资源(<url->pattern>index.jsp</url-pattern>)”时执行,如果需要“放行”,那么需要调用FilterChain的doFilter(ServletRequest,ServletResponse)方法,如果不调用FilterChain的doFilter()方法,那么目标资源将无法执行;

五、FilterConfig

  Filter接口中的init()方法的参数类型为FilterConfig类型。它的功能与ServletConfig相似,与web.xml文件中的配置信息对应。下面是FilterConfig的功能介绍:

  • ServletContext getServletContext():获取ServletContext的方法;
  • String getFilterName():获取Filter的配置名称;与<filter-name>元素对应;
  • String getInitParameter(String name):获取Filter的初始化配置,与<init-param>元素对应;
  • Enumeration getInitParameterNames():获取所有初始化参数的名称。

六、FilterChain

  doFilter()方法的参数中有一个类型为FilterChain的参数,它只有一个方法:doFilter(ServletRequest,ServletResponse)。

  前面我们说doFilter()方法的放行,让请求流访问目标资源!但这么说不严密,其实调用该方法的意思是,“我(当前Filter)”放行了,但不代表其他人(其他过滤器)也放行。

  也就是说,一个目标资源上,可能部署了多个过滤器,就好比在你去北京的路上有多个打劫的匪人(过滤器),而其中第一伙匪人放行了,但不代表第二伙匪人也放行了,所以调用FilterChain类的doFilter()方法表示的是执行下一个过滤器的doFilter()方法,或者是执行目标资源!

  如果当前过滤器是最后一个过滤器,那么调用chain.doFilter()方法表示执行目标资源;如果不是最后一个过滤器,那么chain.doFilter()表示执行下一个过滤器的doFilter()方法。

七、多个过滤器的执行顺序

  一个目标资源可以指定多个过滤器,过滤器的执行顺序是在web.xml文件中的部署顺序。

  MyFilter1:

public class MyFilter1 extends HttpFilter {
public void doFilter(HttpServletRequest request, HttpServletResponse response,
FilterChain chain) throws IOException, ServletException {
System.out.println("filter1 start...");
chain.doFilter(request, response);//放行,执行MyFilter2的doFilter()方法
System.out.println("filter1 end...");
}
}

  MyFilter2:

public class MyFilter2 extends HttpFilter {
public void doFilter(HttpServletRequest request, HttpServletResponse response,
FilterChain chain) throws IOException, ServletException {
System.out.println("filter2 start...");
chain.doFilter(request, response);//放行,执行目标资源
System.out.println("filter2 end...");
}
}

  web.xml

<filter>
<!--因为MyFilter1配置在前面,所以先执行MyFilter1的doFilter()方法。-->
<filter-name>myFilter1 </filter-name>
<filter-class>cn.itcast.filter.MyFilter1</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter1</filter-name>
<url-pattern>/index.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>myFilter2</filter-name>
<filter-class>cn.itcast.filter.MyFilter2</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter2</filter-name>
<url-pattern>/index.jsp</url-pattern>
</filter-mapping>

  index.jsp

  <body>
This is my JSP page. <br>
<h1>index.jsp</h1>
<%System.out.println("index.jsp"); %>
</body>

  当有用户访问index.jsp页面时,输出结果如下:

filter1 start...
filter2 start...
index.jsp
filter2 end...
filter1 end...

八、四种拦截方式

  我们来做个测试,写一个过滤器,指定过滤的资源为b.jsp,然后我们在浏览器中直接访问b.jsp,你会发现过滤器执行了!

  但是,当我们在a.jsp中request.getRequestDispathcer(“/b.jsp”).forward(request,response)时,就不会再执行过滤器了!也就是说,默认情况下,只能直接访问目标资源才会执行过滤器,而forward执行目标资源,不会执行过滤器

  其实过滤器有四种拦截方式!分别是:REQUEST、FORWARD、INCLUDE、ERROR。

  • REQUEST(默认):直接访问目标资源时执行过滤器。包括:在地址栏中直接访问、表单提交、超链接、重定向,只要在地址栏中可以看到目标资源的路径,就是REQUEST;
  • FORWARD:转发访问执行过滤器。包括RequestDispatcher#forward()方法、<jsp:forward>标签都是转发访问;
  • INCLUDE:包含访问执行过滤器。包括RequestDispatcher#include()方法、<jsp:include>标签都是包含访问;
  • ERROR:当目标资源在web.xml中配置为<error-page>中时,并且真的出现了异常,转发到目标资源时,会执行过滤器。

  可以在<filter-mapping>中添加0~n个<dispatcher>子元素,来说明当前访问的拦截方式。

<filter-mapping>
<filter-name>myfilter</filter-name>
<url-pattern>/b.jsp</url-pattern>
<!--b.jsp为目标资源,当直接请求b.jsp时,会执行过滤器-->
<dispatcher>REQUEST</dispatcher>
<!--当转发到b.jsp页面时,会执行过滤器-->
<dispatcher>FORWARD</dispatcher>
</filter-mapping> <!--当没有给出拦截方式时,那么默认为REQUEST-->
<filter-mapping>
<filter-name>myfilter</filter-name>
<url-pattern>/b.jsp</url-pattern>
</filter-mapping> <filter-mapping>
<filter-name>myfilter</filter-name>
<url-pattern>/b.jsp</url-pattern>
<!--当转发到b.jsp页面时,会执行过滤器!
因为已经给出了<dispatcher>FORWARD</dispatcher>了,
那么就没有默认的REQUEST了!所以只有在转发到b.jsp时才会执行过滤,
而转发到b.jsp时,不会执行b.jsp-->
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

九、过滤器的应用场景

  过滤器的应用场景:

  • 执行目标资源之前做预处理工作,例如设置编码,这种试通常都会放行,只是在目标资源执行之前做一些准备工作;(

    几乎是的Sevlet中都需要写request.setCharacterEndoing() 可以把它入到一个Filter中)

  • 通过条件判断是否放行,例如校验当前用户是否已经登录,或者用户IP是否已经被禁用;
  • 在目标资源执行后,做一些后续的特殊处理工作,例如把目标资源输出的数据进行处理;

  下面通过几个具体的案例来说明过滤器的应用:

9.1 统一全站字符编码

乱码问题:

  • 获取请求参数中的乱码问题;

    • POST请求:request.setCharacterEncoding(“utf-8”);
    • GET请求:new String(request.getParameter(“xxx”).getBytes(“iso-8859-1”), “utf-8”);
  • 响应的乱码问题:response.setContextType(“text/html;charset=utf-8”)。

  基本上在每个Servlet中都要处理乱码问题,所以应该把这个工作放到过滤器中来完成。

  

参考:https://www.cnblogs.com/xdp-gacl/p/3948353.html

JavaWeb学习笔记(二十二)—— 过滤器filter的更多相关文章

  1. JavaWeb学习笔记(十二)—— JDBC的基本使用

    一.JDBC概述 1.1 数据库驱动 这里的驱动的概念和平时听到的那种驱动的概念是一样的,比如平时购买的声卡,网卡直接插到计算机上面是不能用的,必须要安装相应的驱动程序之后才能够使用声卡和网卡,同样道 ...

  2. Javaweb学习笔记——(十二)——————JSP指令:page指令、include指令、taglib指令,JavaBean,内省,EL表达式

    JSP指令JSP指令分类 JSP有三大指令: *page指令 *include指令 *taglib指令 在JSP中没有任何指令是必须的. 但基本上每个JSP都是使用page指令============ ...

  3. VSTO 学习笔记(十二)自定义公式与Ribbon

    原文:VSTO 学习笔记(十二)自定义公式与Ribbon 这几天工作中在开发一个Excel插件,包含自定义公式,根据条件从数据库中查询结果.这次我们来做一个简单的测试,达到类似的目的. 即在Excel ...

  4. 汇编入门学习笔记 (十二)—— int指令、port

    疯狂的暑假学习之  汇编入门学习笔记 (十二)--  int指令.port 參考: <汇编语言> 王爽 第13.14章 一.int指令 1. int指令引发的中断 int n指令,相当于引 ...

  5. Binder学习笔记(十二)—— binder_transaction(...)都干了什么?

    binder_open(...)都干了什么? 在回答binder_transaction(...)之前,还有一些基础设施要去探究,比如binder_open(...),binder_mmap(...) ...

  6. javaweb学习总结(四十二)——Filter(过滤器)学习

    一.Filter简介 Filter也称之为过滤器,它是Servlet技术中最激动人心的技术,WEB开发人员通过Filter技术,对web服务器管理的所有web资源:例如Jsp, Servlet, 静态 ...

  7. java之jvm学习笔记六-十二(实践写自己的安全管理器)(jar包的代码认证和签名) (实践对jar包的代码签名) (策略文件)(策略和保护域) (访问控制器) (访问控制器的栈校验机制) (jvm基本结构)

    java之jvm学习笔记六(实践写自己的安全管理器) 安全管理器SecurityManager里设计的内容实在是非常的庞大,它的核心方法就是checkPerssiom这个方法里又调用 AccessCo ...

  8. Android学习笔记(十二)——实战:制作一个聊天界面

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 运用简单的布局知识,我们可以来尝试制作一个聊天界面. 一.制作 Nine-Patch 图片 : Nine-Pa ...

  9. MySQL数据库学习笔记(十二)----开源工具DbUtils的使用(数据库的增删改查)

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  10. Dynamic CRM 2013学习笔记(十二)实现子表合计(汇总,求和)功能的通用插件

    上一篇 Dynamic CRM 2013学习笔记(十一)利用Javascript实现子表合计(汇总,求和)功能 , 介绍了如何用js来实现子表合计功能,这种方法要求在各个表单上添加js方法,如果有很多 ...

随机推荐

  1. 磁盘io测试工具

    1. ATTO Disk Benchmark 2.DiskSpd磁盘性能测试工具

  2. appium desktop v1.2.7在android7.0上运行报错“Error: Error executing adbExec”

    1.参考下面链接,https://stackoverflow.com/questions/42283921/unable-to-run-appium-tests-on-android-7-0:得知需要 ...

  3. smarty 使用php函数

    strtotime() time() <{if strtotime($activity.start_time) gt time()}> <a href="?action=d ...

  4. [Excel]鼠标右键菜单没有新建Word、Excel、PPT怎么办?

    很多朋友在安装好Office(2010或2013等)之后,发现右键新建中没有Word.Excel.PowerPoint等项,但是自己的Office却明明安装好了.这个时候该怎么办呢?这里,本文为大家提 ...

  5. easyui combogrid 下拉框 智能输入

    1. 后台代码 using System;using System.Collections;using System.Collections.Generic;using System.Linq;usi ...

  6. Excel数据透视表

    Excel中每列是一个字段,每行是一条记录. 值字段设置,双击更改统计方法. 双击透视表中的数据可以看具体是哪些记录贡献的这些数据. 显示报表筛选页,生成多个工作簿.

  7. windows cmd命令相关知识和经验的碎片化记录

    1.循环遍历当前文件夹下的所有*.dll文件,并打印其绝对路径和相对路径 ``` for /f "tokens=*" %%a in ('dir /s/b/a-d "*.d ...

  8. Android 修改 TextView 的全局默认颜色。

    如果你的应用中大多数TextView的颜色是红色, 或者其他颜色, 你是为每一个TextView都设置一次颜色, 还是有其他更好的办法, 这里教你怎么修改TextView的默认颜色. 当然我们Text ...

  9. 深入理解java虚拟机(七)类加载的时机

    Class 文件中描述的各种信息都必须加载到虚拟机中才能运行和使用.而虚拟机怎么加载这些Class 文件呢?Class 文件进入到虚拟机中会发生什么变化呢? 虚拟机类加载机制是指 虚拟机把描述类的数据 ...

  10. 【小梅哥FPGA进阶教程】第十一章 四通道幅频相可调DDS信号发生器

    十一.四通道幅频相可调DDS信号发生器 本文由山东大学研友袁卓贡献,特此感谢 实验目标 实现多通道可调信号发生器 实验平台 芯航线FPGA核心板.ADDA模块 实验现象 实现基于FPGA的多通道可调信 ...