本文共 981 字,大约阅读时间需要 3 分钟。
场景 | 监听者接口 | 事件类型 |
想 知道一个 Web应用上下问中 是否增加,删除或替换了一个属性. | ServletContextAttributeListener (attributeAdded,attributeRemoved,attributeReplaced) | ServletContextAttributeEvent |
你想知道有多少个并发用户,也就是说想跟踪活动的会话 . | HttpSessionListener(sessionCreated, sessionDestroyed) | HttpSessionEvent |
每次请求到来时想知道以便建立日志记录. | ServletRequestListener (requestlnitialized,requestDestroyed) | ServletRequestEvent |
你想知道什么时候增加,删除或替换一个请求属性. | ServletRequestAttributeListener(attributeAdded,attributeRemoved,attributeReplaced) | ServletRequestAttributeEvent |
你有一个属性类(这个类表示的对象 将被放在一个属性中),而且你希望这个类型的对象绑定到一个会话或者会话删除时得到通知. | HttpSessionBindingListener(valueBound,valueUnbound) | HttpSessionBindingEvent |
你想知道什么时候增加,删除或替换一个会话属性. | HttpSessionAttributeListener(attributeAdded,attributeRemoved,attributeReplaced) | HttpSessionBindingEvent |
你想知道是否粗行间或撤销了一个上下文. | ServletContextListener(contextlnitialized,contextDestroyed) | ServletContextEvent |
你有一个属性类,而且希望此类对象绑定的会话迁移到另一个JVM时得到通知. | SessionActivationListener(sessionDidActivate,sessionWillPassivate) | HttpSessionEvent |
转载地址:http://hiesi.baihongyu.com/