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的都不陌生,常见的套路都是拖一个控件,然后给它绑定一个监听器,即可以对该对象的事件进行监听以便发生响 ...
随机推荐
- windows curl命令详解
概述 Curl命令可以通过命令行的方式,执行Http请求.在Elasticsearch中有使用的场景,因此这里研究下如何在windows下执行curl命令. 软件下载 下载地址:https://cur ...
- Android捕获全局异常
Android捕获全局异常 程序避免不了出现bug,导致程序崩溃,为了尽量不影响用户体验,可以全局捕获异常 效果图 异常捕获处理前 异常捕获处理后(将程序重新启动) 捕获异常的工具类 package ...
- Dynamics CRM2013 从外部系统取到CRM系统的用户头像
CRM从2013开始引入了entityimage的概念,具体这个字段怎么设置的,图像是怎么上传的这里就不谈了.说实在的这玩意在项目中没啥用,所以也没去关注,直到最近遇到了个难题,要在外部系统去获取这个 ...
- 学习Android路上的一些感慨和总结,慢慢来,比较快!
学习Android路上的一些感慨和总结,慢慢来,比较快! 一直想对自己的学习路程做一个总结,来告别某一个阶段的过去,迎接某一个阶段的来临,一直抽不出时间来,于是零零散散的写了点-,到现在,也已经积攒了 ...
- C语言与java语言中数据类型的差别总结
在学习java的时候,看到char ch = '男' ; 我就觉得很奇怪,char类型不是占用一个字节吗?为什么定义成一个汉字被说成是一个字符了? 原来,在C语言中,char在32位操作系统下占用1 ...
- 剑指Offer--图的操作
剑指Offer–图的操作 前言 企业笔试过程中会涉及到数据结构的方方面面,现将有关图的深度优先搜索与广度优先搜索进行整理归纳,方便日后查阅. 在已做过的笔试题目中,可用DFS解决的题目有: & ...
- UNIX网络编程——UNIX域套接字编程和socketpair 函数
一.UNIX Domain Socket IPC socket API原本是为网络通讯设计的,但后来在socket的框架上发展出一种IPC机制,就是UNIX Domain Socket.虽然网络soc ...
- 公司间INVOICE的库存设置
公司间INVOICE 库存设置信息 实施多组织支持的步骤 1. 开发组织架构 2. 定义主要分类帐 3. 定义组织 4. 定义组织间关系 5. 定义职责 6. 为职责设置业务实体配置文件选项 ...
- Cocos2D iOS之旅:如何写一个敲地鼠游戏(六):放置地鼠
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 免责申明:本博客提供的所有翻译文章原稿均来自互联网,仅供学习交流 ...
- 【一天一道LeetCode】#171. Excel Sheet Column Number
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...