java web学习总结(十七) -------------------过滤器

时间:2023-01-26 00:29:30

一、Filter简介

  Filter也称之为过滤器,它是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/BwaevW9QICfPz8XNzcqteoUe3FF51dXDy9vf3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lzS8LHR0VOmTp03b15KSsqBAwfOnz9/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开发入门

3.1、Filter开发步骤

  Filter开发分为二个步骤:

  1. 编写java类实现Filter接口,并实现其doFilter方法。
  2. 在 web.xml 文件中使用<filter>和<filter-mapping>元素对编写的filter类进行注册,并设置它所能拦截的资源。

  过滤器范例:

java web学习总结(十七) -------------------过滤器
 1 package me.gacl.web.filter;
2
3 import java.io.IOException;
4
5 import javax.servlet.Filter;
6 import javax.servlet.FilterChain;
7 import javax.servlet.FilterConfig;
8 import javax.servlet.ServletException;
9 import javax.servlet.ServletRequest;
10 import javax.servlet.ServletResponse;
11
12 /**
13 * @ClassName: FilterDemo01
14 * @Description:filter的三种典型应用:
15 * 1、可以在filter中根据条件决定是否调用chain.doFilter(request, response)方法,
16 * 即是否让目标资源执行
17 * 2、在让目标资源执行之前,可以对request\response作预处理,再让目标资源执行
18 * 3、在目标资源执行之后,可以捕获目标资源的执行结果,从而实现一些特殊的功能
19 * @author: 孤傲苍狼
20 * @date: 2014-8-31 下午10:09:24
21 */
22 public class FilterDemo01 implements Filter {
23
24 @Override
25 public void init(FilterConfig filterConfig) throws ServletException {
26 System.out.println("----过滤器初始化----");
27 }
28
29 @Override
30 public void doFilter(ServletRequest request, ServletResponse response,
31 FilterChain chain) throws IOException, ServletException {
32
33 //对request和response进行一些预处理
34 request.setCharacterEncoding("UTF-8");
35 response.setCharacterEncoding("UTF-8");
36 response.setContentType("text/html;charset=UTF-8");
37
38 System.out.println("FilterDemo01执行前!!!");
39 chain.doFilter(request, response); //让目标资源执行,放行
40 System.out.println("FilterDemo01执行后!!!");
41 }
42
43 @Override
44 public void destroy() {
45 System.out.println("----过滤器销毁----");
46 }
47 }
java web学习总结(十七) -------------------过滤器

  在web. xml中配置过滤器:

java web学习总结(十七) -------------------过滤器
 1 <?xml version="1.0" encoding="UTF-8"?>
2 <web-app version="3.0"
3 xmlns="http://java.sun.com/xml/ns/javaee"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
6 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
7 <display-name></display-name>
8 <welcome-file-list>
9 <welcome-file>index.jsp</welcome-file>
10 </welcome-file-list>
11
12 <!--配置过滤器-->
13 <filter>
14 <filter-name>FilterDemo01</filter-name>
15 <filter-class>me.gacl.web.filter.FilterDemo01</filter-class>
16 </filter>
17
18 <!--映射过滤器-->
19 <filter-mapping>
20 <filter-name>FilterDemo01</filter-name>
21 <!--“/*”表示拦截所有的请求 -->
22 <url-pattern>/*</url-pattern>
23 </filter-mapping>
24
25 </web-app>
java web学习总结(十七) -------------------过滤器

3.2、Filter链

  在一个web应用中,可以开发编写多个Filter,这些Filter组合起来称之为一个Filter链。
  web服务器根据Filter在web.xml文件中的注册顺序,决定先调用哪个Filter,当第一个Filter的doFilter方法被调用时,web服务器会创建一个代表Filter链的FilterChain对象传递给该方法。在doFilter方法中,开发人员如果调用了FilterChain对象的doFilter方法,则web服务器会检查FilterChain对象中是否还有filter,如果有,则调用第2个filter,如果没有,则调用目标资源。

四、Filter的生命周期

4.1、Filter的创建

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

4.2、Filter的销毁

  Web容器调用destroy方法销毁Filter。destroy方法在Filter的生命周期中仅执行一次。在destroy方法中,可以释放过滤器使用的资源。

4.3、FilterConfig接口

  用户在配置filter时,可以使用<init-param>为filter配置一些初始化参数,当web容器实例化Filter对象,调用其init方法时,会把封装了filter初始化参数的filterConfig对象传递进来。因此开发人员在编写filter时,通过filterConfig对象的方法,就可获得:
  String getFilterName():得到filter的名称。
  String getInitParameter(String name): 返回在部署描述中指定名称的初始化参数的值。如果不存在返回null.
  Enumeration getInitParameterNames():返回过滤器的所有初始化参数的名字的枚举集合。
  public ServletContext getServletContext():返回Servlet上下文对象的引用。
范例:利用FilterConfig得到filter配置信息

java web学习总结(十七) -------------------过滤器
 1 package me.gacl.web.filter;
2
3 import java.io.IOException;
4 import java.util.Enumeration;
5 import javax.servlet.Filter;
6 import javax.servlet.FilterChain;
7 import javax.servlet.FilterConfig;
8 import javax.servlet.ServletException;
9 import javax.servlet.ServletRequest;
10 import javax.servlet.ServletResponse;
11
12 public class FilterDemo02 implements Filter {
13
14 /* 过滤器初始化
15 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
16 */
17 @Override
18 public void init(FilterConfig filterConfig) throws ServletException {
19 System.out.println("----过滤器初始化----");
20 /**
21 * <filter>
22 <filter-name>FilterDemo02</filter-name>
23 <filter-class>me.gacl.web.filter.FilterDemo02</filter-class>
24 <!--配置FilterDemo02过滤器的初始化参数-->
25 <init-param>
26 <description>配置FilterDemo02过滤器的初始化参数</description>
27 <param-name>name</param-name>
28 <param-value>gacl</param-value>
29 </init-param>
30 <init-param>
31 <description>配置FilterDemo02过滤器的初始化参数</description>
32 <param-name>like</param-name>
33 <param-value>java</param-value>
34 </init-param>
35 </filter>
36
37 <filter-mapping>
38 <filter-name>FilterDemo02</filter-name>
39 <!--“/*”表示拦截所有的请求 -->
40 <url-pattern>/*</url-pattern>
41 </filter-mapping>
42 */
43 //得到过滤器的名字
44 String filterName = filterConfig.getFilterName();
45 //得到在web.xml文件中配置的初始化参数
46 String initParam1 = filterConfig.getInitParameter("name");
47 String initParam2 = filterConfig.getInitParameter("like");
48 //返回过滤器的所有初始化参数的名字的枚举集合。
49 Enumeration<String> initParameterNames = filterConfig.getInitParameterNames();
50
51 System.out.println(filterName);
52 System.out.println(initParam1);
53 System.out.println(initParam2);
54 while (initParameterNames.hasMoreElements()) {
55 String paramName = (String) initParameterNames.nextElement();
56 System.out.println(paramName);
57 }
58 }
59
60 @Override
61 public void doFilter(ServletRequest request, ServletResponse response,
62 FilterChain chain) throws IOException, ServletException {
63 System.out.println("FilterDemo02执行前!!!");
64 chain.doFilter(request, response); //让目标资源执行,放行
65 System.out.println("FilterDemo02执行后!!!");
66 }
67
68 @Override
69 public void destroy() {
70 System.out.println("----过滤器销毁----");
71 }
72 }
java web学习总结(十七) -------------------过滤器

五、Filter的部署

  Filter的部署分为两个步骤:

  1、注册Filter

  2、映射Filter

5.1、注册Filter

  开发好Filter之后,需要在web.xml文件中进行注册,这样才能够被web服务器调用

  在web.xml文件中注册Filter范例:

java web学习总结(十七) -------------------过滤器
 1 <filter>
2 <description>FilterDemo02过滤器</description>
3 <filter-name>FilterDemo02</filter-name>
4 <filter-class>me.gacl.web.filter.FilterDemo02</filter-class>
5 <!--配置FilterDemo02过滤器的初始化参数-->
6 <init-param>
7 <description>配置FilterDemo02过滤器的初始化参数</description>
8 <param-name>name</param-name>
9 <param-value>gacl</param-value>
10 </init-param>
11 <init-param>
12 <description>配置FilterDemo02过滤器的初始化参数</description>
13 <param-name>like</param-name>
14 <param-value>java</param-value>
15 </init-param>
16 </filter>
java web学习总结(十七) -------------------过滤器

  <description>用于添加描述信息,该元素的内容可为空,<description>可以不配置。

  <filter-name>用于为过滤器指定一个名字,该元素的内容不能为空。
  <filter-class>元素用于指定过滤器的完整的限定类名。
  <init-param>元素用于为过滤器指定初始化参数,它的子元素<param-name>指定参数的名字,<param-value>指定参数的值。在过滤器中,可以使用FilterConfig接口对象来访问初始化参数。如果过滤器不需要指定初始化参数,那么<init-param>元素可以不配置。

5.2、映射Filter

  在web.xml文件中注册了Filter之后,还要在web.xml文件中映射Filter

java web学习总结(十七) -------------------过滤器
1  <!--映射过滤器-->
2 <filter-mapping>
3 <filter-name>FilterDemo02</filter-name>
4 <!--“/*”表示拦截所有的请求 -->
5 <url-pattern>/*</url-pattern>
6 </filter-mapping>
java web学习总结(十七) -------------------过滤器

  <filter-mapping>元素用于设置一个 Filter 所负责拦截的资源。一个Filter拦截的资源可通过两种方式来指定:Servlet 名称和资源访问的请求路径
  <filter-name>子元素用于设置filter的注册名称。该值必须是在<filter>元素中声明过的过滤器的名字
  <url-pattern>设置 filter 所拦截的请求路径(过滤器关联的URL样式)
  <servlet-name>指定过滤器所拦截的Servlet名称。
  <dispatcher>指定过滤器所拦截的资源被
Servlet
容器调用的方式,可以是REQUEST,INCLUDE,FORWARD和ERROR之一,默认REQUEST。用户可以设置多个<dispatcher>
子元素用来指定 Filter 对资源的多种调用方式进行拦截。如下:

java web学习总结(十七) -------------------过滤器
1 <filter-mapping>
2 <filter-name>testFilter</filter-name>
3 <url-pattern>/index.jsp</url-pattern>
4 <dispatcher>REQUEST</dispatcher>
5 <dispatcher>FORWARD</dispatcher>
6 </filter-mapping>
java web学习总结(十七) -------------------过滤器

  <dispatcher> 子元素可以设置的值及其意义:

  1. REQUEST:当用户直接访问页面时,Web容器将会调用过滤器。如果目标资源是通过RequestDispatcher的include()或forward()方法访问时,那么该过滤器就不会被调用。
  2. INCLUDE:如果目标资源是通过RequestDispatcher的include()方法访问时,那么该过滤器将被调用。除此之外,该过滤器不会被调用。
  3. FORWARD:如果目标资源是通过RequestDispatcher的forward()方法访问时,那么该过滤器将被调用,除此之外,该过滤器不会被调用。
  4. ERROR:如果目标资源是通过声明式异常处理机制调用时,那么该过滤器将被调用。除此之外,过滤器不会被调用。