JavaWeb—监听器Listener
1.简介
Listener是Servlet的监听器,Servlet 监听器用于监听一些重要事件的发生,监听器对象在事情发生前、发生后可以做一些必要的处理。
JavaWeb里面的listener是通过观察者设计模式进行实现的。
观察者模式又叫发布订阅模式或者监听器模式。在该模式中有两个角色:观察者和被观察者(通常也叫做主题)。观察者在主题里面注册自己感兴趣的事件,当这个事件发生时,主题会通过回调接口的方式通知观察者。
举个生活中的例子:订阅报纸。任何一个家庭或个人都可以向报社订阅报纸。这里报社就是“主题”,家庭就是“观察者”。比如家庭需要订阅明天早晨的报纸,这个就是“事件”。到了第二天早晨,报纸生产出来了,这个就是“事件发生”。当事件发生时,送报员将报纸送到家庭的信箱里面,这里的信箱就是“回调接口”。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjYAAAB6CAIAAAAj0Y5cAAAV0klEQVR4nO2dSVsa6f6G+Qp+A1eu3brM0Q/gwpUbVy5Z5L/wunCdTnef/rcn9oE2RhOjbQZjTASMESc0iEYhosYJrTiUYBxwVhzQcBZvAVVFMSgF/KLPfT0LW4vSTpnn5h2qogkCAAAAJNFk+wcAAAAAlIGiAAAAEAWKAgAAQBQoCgAAAFGgKAAAAESBogAAABAFigIAAEAUKAoAAABRoCgAAABEgaIAAAAQBYoCAACBe/frEVWi1hWBogBQH79R70v2WI43WhJ9BmSIe/frWyarkBRDSFFZd/WtiSqXE4TxGwvdDtnnOF6XYzckaH+fQRuyi8Wt0/vZB+FXObQJz8C+u71UK7UU53NwCod69a7SHJdR/KWkfk6QDqCoW6iorP9x3IJAUWlAsegTt7/fWGgvzRESVlT4M6U5Lp1khCQ5PlGkKgoGg0GfIfzzWNylhbyX/ZDsA5BpUGjUCg2KIhEoKi04tHad3h/k/KK6VxpdSYgc4NW7wvIQXBX0GwujNaN4EsXD/F7ZJy3u8GDLobXrtD4oKqug0KgVGhRFIlBUGnFYYi0LsQGQzFg3VZRkpKUQpaGb+Gyij0WK8urdSRgRqAUKjVqhQVEkAkWpiUMrto7P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rcIo7dZTeN55zBk80S1TQdEdviBDoNCoFRoURSJQFCniPbzVYUl55g1jI7qg0KgVGhRFIlAUABRAoVErNCiKRKAoACiAQqNWaFAUiUBRAFAAhUat0KAoEoGiAKAACo1aoUFRJAJFAUABFBq1QoOiSASKAoACKDRqhQZFkQgUBQAFUGjUCg2KIhEoCgAK3Ltfj6gSta4IFEUiUBQAAESjgqIQUm86AADg1pCqogAAAIA0AUUBAAAgChQFAACAKFAUAAAAokBRAAAAiAJFAQAAIAoUBQAAgChQFAAAAKJAUQAAAIjyP/ZyptgFxwEBAAAAAElFTkSuQmCC" alt="" />
对于JavaWeb里面的监听器,Servlet规范定义了一些列的Listener接口类,通过接口类的方式将事件暴露给应用程序,应用程序如果想监听其感兴趣的事件,那么不必去直接注册对应的事件,而是编写自己的listener实现相应的接口类,并将自己的listener注册到servlet容器。当程序关心的事件发生时,servlet容器会通知listener,回调listener里面的方法。这里自定义的listener就是观察者,servlet容器就是主题。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlIAAACyCAIAAAAGZraPAAAZ5ElEQVR4nO2dTVNT2b6H8xX8BowcO+2encIP4MDJddK36pY9uFUMzsSqOLmD6/F0n75NSx/SNKLS2r6hogQQCaCIvKgECSACkYgYiSIG5DWAQOcO9k6y35Jswk4WYT1P/QaY7KxEEv+P/7XW3nHFAQAApMEl+gUAAAAUDrQHAAASgfYAAEAi0B4AAEgE2gMAAIlAe7tg8ty3LpfL9X2L6BcCAAA5Iqf2FH/tWl9oDwCg2EF7AAAgEWgPAAAkYp9qT51OVPn23KTmvpbvXVrM8mr5PvEYzaGJMQyPNg2hv1//zOqdycMzPpH5JaU9IjlO8jCMDACQH/ah9vTK03vASlomSygW+dY0ilFQpodbjq6VlKX20jyR4UGZXrF5HLQHAJAf9p/2VEtoCn/L9+of1bvMItKLJuWZxCCqSZNHpZnkTD5RXPew1E1W2sv4RIljtK/PvDEmOY5lpwgAAM6x37SXabOkQTq6R1io0NxQGeyUvaUyHmet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6ftHCk5sZMIyS1d6TEeETCfPa0V15xqkT/vGgPAEAwRag9xWHafZJNxzQLaRZqMbaAWUbQNoKJW9QDtE1hlknOitSLST4K7QEACKb4tOc+bmEOpa9SxKb92VI2WUdIaC+jO21pz9DwoT0AAMEUnfYU2VijOknpzJJTi8YZThsjWM2UVhi3qNjSnr7hQ3sAAIIpOu1p9pikk5ZeSKYuzcYITmpPOxraAwAQTNFpL51sdNEoyiQhOyM4qz31yJLvmtAeAIBgik57SvemP9/AHGWe88ixitSpCLsZwWHtJQf8Bu0BAIil+LSX2G+i81bFqRK9TtQG6/ARK8NlHWEX2ktzjqDxgpzaBUW0BwAgjCLUXro9KXrTqFsoLQxkYwRb2tM8hU5mltqzOikC7QEAFJxi1J5ZOabz04eTZ9qZrwdtYwR72tPp07B108K1iZPcre5CewAAhaFYtUf2GLQHAHKC9iQN2gMAOUF7kgbtAYCcoD1Jg/YAQE7QnqRBewAgJ2hP0qA9AJATtCdp0B4AyAnakzRoDwDkBO1JGrQHAHKC9iQN2gMAOUF7kgbtAYCcoD1Jg/YAQE7QnqRBewAgJ2hP0qA9AJATtCdp0B4AyAnakzRoDwDkBO1JGrQHAHKC9iQN2gMAOclde6TY4+wnCQCgKMhRewAAAMUI2gMAAIlAewAAIBFoDwAAJALtAQCARKA9AACQCLQHAAASgfYAAEAi0B4AAEjE/wNa8BIDXFIpnAAAAABJRU5ErkJggg==" alt="" />
2.分类
现在我们分析下,servlet规范为我们定义了哪些事件。更准确的说是定义了哪些监听接口。下面的介绍都是以servlet3.0规范为准。
servlet3.0为我们提供了8个监听器接口,按照它们的作用域来划分的话可以分为三类:
1.servlet上下文相关监听接口:
- ServletContextListener
- ServletContextAttributeListener
2.http session相关监听接口:
- HttpSessionListener
- HttpSessionActivationListener
- HttpSessionAttributeListener
- HttpSessionBindingListener
3.servlet request相关监听接口:
- ServletRequestListener
- ServletRequestAttributeListener
3.Java编写Listener实例
Listener编写分为两步:
- 编写自己的listener,实现特定的Listener接口
- 在web.xml里面注册自己的listener(也可以通过注解的方式,道理是一样的)
ListenerDemo.java(这里继承ServletContextListener接口):
public class ListenerDemo implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
System.out.println("----------ServletContextListener.contextInitialized-----------");
} @Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
System.out.println("----------ServletContextListener.contextDestroyed----------");
}
}
web.xml:
<listener>
<listener-class>com.xzh.ListenerDemo</listener-class>
</listener>
效果图:
注意:结果中可以看到listener比filter先执行。
4.源码分析
4.1 ServletContextListener
public interface ServletContextListener extends EventListener {
void contextInitialized(ServletContextEvent var1); void contextDestroyed(ServletContextEvent var1);
}
servlet上下文监听器接口,对应着两个事件:servlet上下文初始化事件和servlet上下文即将关闭事件。
当web应用初始化的时候,servlet容器会构造ServletContextEven实例,并回调contextInitialize方法。当servlet上下文即将关闭时,一般是关闭服务器之前,servlet容器会构造ServletContextEven实例,并回调contextDestroyed方法。这里需要注意的是,contextDestroyed方法的执行会在所有的servlet和filter执行完destroy方法之后。
4.2 ServletContextAttributeListener
public interface ServletContextAttributeListener extends EventListener {
void attributeAdded(ServletContextAttributeEvent var1); void attributeRemoved(ServletContextAttributeEvent var1); void attributeReplaced(ServletContextAttributeEvent var1);
}
当servlet上文属性发生增、删、改的时候,servlet容器构造ServletContextAttributeEvent事件对象,分别回调attributeAdded、attributeRemoved、attributeReplaced方法。
这里需要注意的是attributeReplaced方法,当属性的值被替换的时候回调。这个时候如果调用ServletContextAttributeEvent.getValue()方法返回的是替换之前的属性值。
4.3 HttpSessionListener
public interface HttpSessionListener extends EventListener {
void sessionCreated(HttpSessionEvent var1); void sessionDestroyed(HttpSessionEvent var1);
}
当session被创建和销毁的时候,servlet容器构造HttpSessionEvent事件对象,并回调sessionCreated和sessionDestroyed方法。
4.4 HttpSessionActivationListener
public interface HttpSessionActivationListener extends EventListener {
void sessionWillPassivate(HttpSessionEvent var1); void sessionDidActivate(HttpSessionEvent var1);
}
当session将要钝化或已被激活时,servlet容器构造HttpSessionEvent事件对象,回调sessionWillPassivate和sessionDidActivate方法。
这里解释下钝化和激活:钝化是指服务器内存不够了或者session的活动超时时间到了,把最近不活动的session序列化到磁盘。激活是指某个钝化的session又被访问了,从磁盘将session反序列化到内存。
这里可以看出要想钝化和激活,首先session得可序列化和反序列化。同时我们在编程过程中,session尽量用String、Integer等简单的对象,尽量不要用list、map等集合。3.5
4.5 HttpSessionAttributeListener
public interface HttpSessionAttributeListener extends EventListener {
void attributeAdded(HttpSessionBindingEvent var1); void attributeRemoved(HttpSessionBindingEvent var1); void attributeReplaced(HttpSessionBindingEvent var1);
}
当session属性发生增、删、改的时候,servlet容器构造HttpSessionBindingEvent事件对象,分别回调attributeAdded、attributeRemoved、attributeReplaced方法。
这里需要注意的是attributeReplaced方法,当属性的值被替换的时候回调。这个时候如果调用ServletContextAttributeEvent.getValue()方法返回的是替换之前的属性值。
当调用session的invalidate方法或者session失效时,也会回调attributeRemoved方法。
4.6 HttpSessionBindingListener
public interface HttpSessionBindingListener extends EventListener {
void valueBound(HttpSessionBindingEvent var1); void valueUnbound(HttpSessionBindingEvent var1);
}
这个监听器也是监听session的属性变化。当session属性发生增和删,也就是属性值绑定和属性值解绑的时候,servlet容器构造HttpSessionBindingEvent事件对象,分别回调valueBound、valueUnbound方法。
这么一看和HttpSessionAttributeListener没什么区别,其实不是这样。两者有个本质的区别就是事件触发的条件。
当session的属性有任何的变化,servlet容器都会通知HttpSessionAttributeListener。但是对于HttpSessionBindingListener,只有当绑定或解绑的属性值是监听器的实例时,servlet容器才会通知。
4.7 ServletRequestListener
public interface ServletRequestListener extends EventListener {
void requestDestroyed(ServletRequestEvent var1); void requestInitialized(ServletRequestEvent var1);
}
当请求初始化或者销毁时,即客户端请求进入web应用(进入servlet或者第一个filter)或web应用返回响应给客户端(退出servlet或者第一个filter)。servlet容器构造ServletRequestEvent实例,回调requestInitialized和requestDestroyed方法。
4.8 ServletRequestAttributeListener
public interface ServletRequestAttributeListener extends EventListener {
void attributeAdded(ServletRequestAttributeEvent var1); void attributeRemoved(ServletRequestAttributeEvent var1); void attributeReplaced(ServletRequestAttributeEvent var1);
}
当请求的属性发生增、删、改的时候,servlet容器构造ServletRequestAttributeEvent事件对象,分别回调attributeAdded、attributeRemoved、attributeReplaced方法。
这里需要注意的是attributeReplaced方法,当属性的值被替换的时候回调。这个时候如果调用ServletRequestAttributeEvent.getValue()方法返回的是替换之前的属性值。
参考:
JavaWeb—监听器Listener的更多相关文章
- javaweb学习总结(四十七)——监听器(Listener)在开发中的应用
监听器在JavaWeb开发中用得比较多,下面说一下监听器(Listener)在开发中的常见应用 一.统计当前在线人数 在JavaWeb应用开发中,有时候我们需要统计当前在线的用户数,此时就可以使用监听 ...
- javaWeb学习总结(11)- 监听器(Listener)在开发中的应用
监听器在JavaWeb开发中用得比较多,下面说一下监听器(Listener)在开发中的常见应用 一.统计当前在线人数 在JavaWeb应用开发中,有时候我们需要统计当前在线的用户数,此时就可以使用监听 ...
- javaWeb学习总结(11)- 监听器(Listener)学习
一.监听器介绍 1.1.监听器的概念 监听器是一个专门用于对其他对象身上发生的事件或状态改变进行监听和相应处理的对象,当被监视的对象发生情况时,立即采取相应的行动.监听器其 实就是一个实现特定接口的普 ...
- JavaWeb学习 (二十七)————监听器(Listener)在开发中的应用
监听器在JavaWeb开发中用得比较多,下面说一下监听器(Listener)在开发中的常见应用 一.统计当前在线人数 在JavaWeb应用开发中,有时候我们需要统计当前在线的用户数,此时就可以使用监听 ...
- JavaWeb学习笔记(二十一)—— 监听器Listener
一.监听器概述 JavaWeb中的监听器是Servlet规范中定义的一种特殊类,它用于监听web应用程序中的ServletContext, HttpSession和 ServletRequest等域对 ...
- Javaweb基础--->监听器listener(转发)
JavaWeb中的监听器 1.基本概念 JavaWeb中的监听器是Servlet规范中定义的一种特殊类,它用于监听web应用程序中的ServletContext, HttpSession和 Servl ...
- 深入分析JavaWeb Item38 -- 监听器(Listener)高速学习
一.监听器介绍 1.1.监听器的概念 监听器是一个专门用于对其它对象身上发生的事件或状态改变进行监听和对应处理的对象,当被监视的对象发生情况时,马上採取对应的行动.监听器事实上就是一个实现特定接口的普 ...
- 深入分析JavaWeb Item39 -- 监听器(Listener)学习进阶
一.监听域对象中属性的变更的监听器 域对象中属性的变更的事件监听器就是用来监听 ServletContext, HttpSession, HttpServletRequest 这三个对象中的属性变更信 ...
- JavaWeb监听器详解
1 JavaWeb监听器概述 在JavaWeb被监听的事件源为:ServletContext.HttpSession.ServletRequest,即三大域对象.有监听域对象"创建" ...
随机推荐
- Android JNI和NDK学习(03)--动态方式实现JNI(转)
本文转自:http://www.cnblogs.com/skywang12345/archive/2013/05/23/3092491.html 前面总结了静态实现JNI的方法,本文介绍如何动态实现J ...
- ex:0602-169 遇到不完整或无效的多字节字符,转换失败
错误原因:在AIX系统中,用vi命令编辑文件,出现rt错误,是因为AIX系统不识别文件编码格式. 解决方法:建议重新新建一个编码格式为ASC的文件,再重新上传到AIX系统中,或者改变访问linux的客 ...
- openWRT自学---基于backfire版本,分析其Make命令的执行过程和各阶段的主要产物
准备阶段:从SVN下载backfire的编译环境(位置是:svn co svn://svn.openwrt.org/openwrt/branches/backfire),然后按照openWRT的要求, ...
- WebException获取详细内容 记录
http://bbs.csdn.net/topics/390883361 来自此处. 问题.某个接口.返回错误消息用的是400.所以必须知道具体的内容. using System; using Sys ...
- 椭圆曲线ECC基本概念
椭圆曲线的曲线方程是以下形式的三次方程: y2+axy+by=x3+cx2+dx+e a,b,c,d,e是满足某些简单条件的实数.定义中包含一个称为无穷点的元素,记为O 如果其上的3个点位于同一直线上 ...
- 导入mysql文件提示“ASCII '\0' appeared in the statement”
在windows服务器上导入mysql文件时,出现以下报错:ASCII '\0' appeared in the statement, but this is not allowed unless o ...
- CSS隐藏滚动条但又能滚动,不用js实现
隐藏多余的内容,但是可以滑动查看 原理就在于padding-right:17px;把滚动条挤出去隐藏了
- 学习spring2--跟我一起学Spring 3(3)–使用Spring开发第一个HelloWorld应用
http://www.importnew.com/13246.html 首页 所有文章 资讯 Web 架构 基础技术 书籍 教程 我要投稿 更多频道 » - 导航条 - 首页 所有文章 资讯 ...
- YII安装步骤(windows)
一.首先你得下个YII框架的源码 :下载地址:http://www.yiiframework.com/download/ 二.把下载到的源码解压放到一个PHP可访问的位置:如我的 F:\site(已具 ...
- 从头认识java-13.9 隐式和显示的创建类型实例
对于上一章节擦除引起的问题与解决的方法有读者提出过于简单.这里解释一下:由于笔者本身也遇不到对应的问题.仅仅是凭空想像一些有可能的问题,基于水平有限,因此上一章节写的比較简单,欢迎广大读者踊跃提意见, ...