/**
      * 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的更多相关文章

  1. 几百道常见Java初中级面试题

     注:  有的面试题是我面试的时候遇到的,有的是偶然看见的,还有的是朋友提供的, 稍作整理,以供参考.大部分的应该都是这些了,包含了基础,以及相对深入一点点的东西.   JAVA面试题集 基础知识: ...

  2. 浅谈servlet版本

    说白话,eclipseJ2EE版本新建一个web项目后,在IDE中的项目根目录下会看到2.3,2.4,2.5,3.0,3.1....据说最新的4.0在路上,已经有草案了,很期待ing. 360百科是这 ...

  3. JTSL/EL Expression学习

    最早的一个学习笔记,时间过去了久了,供java web初学者参考. JTSL/EL Expression学习安排 学习目标:掌握几个常见标签的使用,通晓工作原理,详细到代码层面,遇到问题时能查得出异常 ...

  4. servlet--百度百科

    Servlet(Server Applet),全称Java Servlet, 未有中文译文.是用Java编写的服务器端程序.其主要功能在于交互式地浏览和修改数据,生成动态Web内容.狭义的Servle ...

  5. Spark案例分析

    一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...

  6. Java监听器

    监听器 1.概念 监听器:主要是用来监听特定对象的创建,属性的变化的!,本质上却是一个实现特定接口的普通java类! 对象分为自己创建自己使用的,和别人创建自己用的,自己创建的不需要监听,值需要取监听 ...

  7. Java EE 学习总结

    1.Java EE WEB 工程项目文件结构 组成:静态HTML页.Servlet.JSP和其他相关的class: 每个组件在WEB应用中都有固定的存放目录. WEB应用的配置信息存放在web.xml ...

  8. JAVA监听器Listener

    JAVA监听器Listener 一. 简介 监听器用于对web中内置对象的状态或者属性变化进行监听并做出相应响应的一种Servlet;在内置对象的生命周期中,产生.销毁等状态发生变化时,监听器就会进行 ...

  9. java Web三大组件--监听器

    监听器概述 监听器(Listener)是一种特殊的Servlet技术,它可以监听Web应用的上下文信息.Servlet请求信息和Servlet会话信息,即ServletContext.ServletR ...

  10. 在Java Web程序中使用监听器可以通过以下两种方法

    之前学习了很多涉及servlet的内容,本小结我们说一下监听器,说起监听器,编过桌面程序和手机App的都不陌生,常见的套路都是拖一个控件,然后给它绑定一个监听器,即可以对该对象的事件进行监听以便发生响 ...

随机推荐

  1. Android开发之手把手教你写ButterKnife框架(三)

    欢迎转载,转载请标明出处: http://blog.csdn.net/johnny901114/article/details/52672188 本文出自:[余志强的博客] 一.概述 上一篇博客讲了, ...

  2. Scala:数组

    http://blog.csdn.net/pipisorry/article/details/52902432 ) 或var z = new Array[String](3) 以上语法中,z 声明一个 ...

  3. Java学习之参数传递详解

    Java中的参数传递问题: 基本类型:形式参数的改变对实际参数没有影响.在参数传递过程中,形参和实参占用了两个完全不同的内存空间. 引用类型:形式参数的改变直接影响实际参数.在参数传递的过程中,形参和 ...

  4. 带你深入理解STL之List容器

    上一篇博客中介绍的vector和数组类似,它拥有一段连续的内存空间,并且起始地址不变,很好的支持了随机存取,但由于是连续空间,所以在中间进行插入.删除等操作时都造成了内存块的拷贝和移动,另外在内存空间 ...

  5. CUDA5.5 的环境变量设置

    为了方便,我写了这个文件用于设置cuda5.5的环境变量. 其中有些环境变量可能用不到,大家根据需要修改就是了. export CUDA_HOME=/usr/local/cuda-5.5 export ...

  6. 任务定义器——SocketProcessor

    将socket扔进线程池前需要定义好任务,要进行哪些逻辑处理由SocketProcessor定义,根据线程池的约定,作为任务必须扩展Runnable.用如下伪代码表示 protected class ...

  7. MyEclipse10+Jdk1.7+OSGI+MySql实现数据库的增删改查

    开发环境: Windows2008R2 64位+MyEclipse10+jdk1.7.0_67+MySql5.5 软件安装:myeclipse-10.0-offline-installer-windo ...

  8. Android初级教程理论知识(第四章内容提供器)

    之前第三章理论知识写到过数据库.数据库是在程序内部自己访问自己.而内容提供器是访问别的程序数据的,即跨程序共享数据.对访问的数据也无非就是CRUD. 内容提供者 应用的数据库是不允许其他应用访问的 内 ...

  9. 【Unity技巧】制作一个简单的NPC

    1. 写在前面 前几天看了cgcookie的一个教程,学习了下怎么根据已有人物模型制作一个仿版的NPC人物,感觉挺好玩的,整理一下放到博客里! 先看一下教程里面的最终效果. 是不是很像个幽灵~ 下面是 ...

  10. 读外部存储的权限READ_EXTERNAL_STORAGE

    READ_EXTERNAL_STORAGE Added in API level 16 String READ_EXTERNAL_STORAGE Allows an application to re ...