Java-ServletRequestEvent-ServletRequestAttributeEvent
/**
* Events of this kind indicate lifecycle
* events for a ServletRequest.
* The source of the event
* is the ServletContext of this web application.
* @see ServletRequestListener
* @since Servlet 2.4
*/
//ServletRequest生命周期的事件
public class ServletRequestEvent extends java.util.EventObject {
private ServletRequest request;
/** Construct a ServletRequestEvent for the given ServletContext
* and ServletRequest.
*
* @param sc the ServletContext of the web application.
* @param request the ServletRequest that is sending the event.
*/
//构造函数,
public ServletRequestEvent(ServletContext sc, ServletRequest request) {
super(sc);
this.request = request;
}
/**
* Returns the ServletRequest that is changing.
*/
public ServletRequest getServletRequest () {
return this.request;
}
/**
* Returns the ServletContext of this web application.
*/
public ServletContext getServletContext () {
return (ServletContext) super.getSource();
}
}
/**
* This is the event class for notifications of changes to the
* attributes of the servlet request in an application.
* @see ServletRequestAttributeListener
* @since Servlet 2.4
*/
public class ServletRequestAttributeEvent extends ServletRequestEvent {
private String name;
private Object value;
/** Construct a ServletRequestAttributeEvent giving the servlet context
* of this web application, the ServletRequest whose attributes are
* changing and the name and value of the attribute.
*
* @param sc the ServletContext that is sending the event.
* @param request the ServletRequest that is sending the event.
* @param name the name of the request attribute.
* @param value the value of the request attribute.
*/
public ServletRequestAttributeEvent(ServletContext sc, ServletRequest request, String name, Object value) {
super(sc, request);
this.name = name;
this.value = value;
}
/**
* Return the name of the attribute that changed on the ServletRequest.
*
* @return the name of the changed request attribute
*/
public String getName() {
return this.name;
}
/**
* Returns the value of the attribute that has been added, removed or
* replaced. If the attribute was added, this is the value of the
* attribute. If the attribute was removed, this is the value of the
* removed attribute. If the attribute was replaced, this is the old
* value of the attribute.
*
* @return the value of the changed request attribute
*/
public Object getValue() {
return this.value;
}
}
Java-ServletRequestEvent-ServletRequestAttributeEvent的更多相关文章
- 几百道常见Java初中级面试题
注: 有的面试题是我面试的时候遇到的,有的是偶然看见的,还有的是朋友提供的, 稍作整理,以供参考.大部分的应该都是这些了,包含了基础,以及相对深入一点点的东西. JAVA面试题集 基础知识: ...
- 浅谈servlet版本
说白话,eclipseJ2EE版本新建一个web项目后,在IDE中的项目根目录下会看到2.3,2.4,2.5,3.0,3.1....据说最新的4.0在路上,已经有草案了,很期待ing. 360百科是这 ...
- JTSL/EL Expression学习
最早的一个学习笔记,时间过去了久了,供java web初学者参考. JTSL/EL Expression学习安排 学习目标:掌握几个常见标签的使用,通晓工作原理,详细到代码层面,遇到问题时能查得出异常 ...
- servlet--百度百科
Servlet(Server Applet),全称Java Servlet, 未有中文译文.是用Java编写的服务器端程序.其主要功能在于交互式地浏览和修改数据,生成动态Web内容.狭义的Servle ...
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
- Java监听器
监听器 1.概念 监听器:主要是用来监听特定对象的创建,属性的变化的!,本质上却是一个实现特定接口的普通java类! 对象分为自己创建自己使用的,和别人创建自己用的,自己创建的不需要监听,值需要取监听 ...
- Java EE 学习总结
1.Java EE WEB 工程项目文件结构 组成:静态HTML页.Servlet.JSP和其他相关的class: 每个组件在WEB应用中都有固定的存放目录. WEB应用的配置信息存放在web.xml ...
- JAVA监听器Listener
JAVA监听器Listener 一. 简介 监听器用于对web中内置对象的状态或者属性变化进行监听并做出相应响应的一种Servlet;在内置对象的生命周期中,产生.销毁等状态发生变化时,监听器就会进行 ...
- java Web三大组件--监听器
监听器概述 监听器(Listener)是一种特殊的Servlet技术,它可以监听Web应用的上下文信息.Servlet请求信息和Servlet会话信息,即ServletContext.ServletR ...
- 在Java Web程序中使用监听器可以通过以下两种方法
之前学习了很多涉及servlet的内容,本小结我们说一下监听器,说起监听器,编过桌面程序和手机App的都不陌生,常见的套路都是拖一个控件,然后给它绑定一个监听器,即可以对该对象的事件进行监听以便发生响 ...
随机推荐
- Android自定义View(LineBreakLayout-自动换行的标签容器)
最近一段时间比较忙,都没有时间更新博客,今天公司的事情忙完得空,继续为我的自定义控件系列博客添砖加瓦.本篇博客讲解的是标签自动换行的布局容器,正好前一阵子有个项目中需要,想了想没什么难度就自己弄了 ...
- Mac小技巧:强制退出程序的六种方法
原帖地址: http://www.cnbeta.com/articles/175447.htm 1.使用键盘快捷键强制退出处于活跃状态的Mac程序 快捷键:Command+Option+Shift+E ...
- XMPP(二)-基于asmack+openfire的安卓客户端(仿QQ)的介绍以及个人心得
关于XMPP第一篇-openfire的搭建写完后,就一直在赶本篇所要介绍的这个基于asmack+openfire的安卓客户端,费了不少精力,因为有不少同学在还在焦急的等待着(自恋了呵呵),所以紧赶慢赶 ...
- T-SQL动态查询(1)——简介
起因: 由于最近工作需要及过去一直的疑问,所以决定着手研究一下动态SQL.由于离开一线开发有点年头了,很多技巧性的东西没有过多研究,作为DBA和<SQL Server性能优化与管理的艺术> ...
- Eclipse编写ExtJS卡死问题 eclise js验证取消
1. Eclipse编写ExtJS卡死问题 eclise js验证取消 近期项目用到了extjs,发现项目编译的时候特别的卡,浪费很多时间而且保存的时候还要编译,因此打算看下如何取消验证extjs.最 ...
- Spring Resource接口获取资源
1.1.1. Resource简介 在Spring内部实现机制,针对于资源文件(配置的xml文件)有一个统一的接口Resource. 1.1.1.1. 接口定义的方法 1.exists():判断资源文 ...
- Java并发框架——AQS之阻塞与唤醒
根据前面的线程阻塞与唤醒小节知道,目前在Java语言层面能实现阻塞唤醒的方式一共有三种:suspend与resume组合.wait与notify组合.park与unpark组合.其中suspend与r ...
- iOS中 HTTP/Socket/TCP/IP通信协议详解 韩俊强的博客
每日更新关注:http://weibo.com/hanjunqiang 新浪微博 简单介绍: // OSI(开放式系统互联), 由ISO(国际化标准组织)制定 // 1. 应用层 // 2. 表示层 ...
- 【Android 应用开发】 Android 相关代码规范 更新中 ...
. 简介 : Android 常用的代码结构, 包括包的规范, 测试用例规范, 数据库模块常用编写规范; 参考 : 之前写的一篇博客 [Android 应用开发] Application 使用分析 ; ...
- 网站开发进阶(三十八)Web前端开发规范文档你需要知道的事
Web前端开发规范文档你需要知道的事 规范目的 为提高团队协作效率, 便于后台人员添加功能及前端后期优化维护, 输出高质量的文档, 特制订此文档. 本规范文档一经确认, 前端开发人员必须按本文档规范进 ...