You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2002/08/01 01:58:11 UTC

cvs commit: jakarta-servletapi-5/src/share/javax/servlet ServletRequestAttributeEvent.java ServletRequestAttributeListener.java ServletRequestEvent.java ServletRequestListener.java

kinman      2002/07/31 16:58:11

  Added:       src/share/javax/servlet ServletRequestAttributeEvent.java
                        ServletRequestAttributeListener.java
                        ServletRequestEvent.java
                        ServletRequestListener.java
  Log:
  - Justyna Horwat supplied this patch.
  
    "adds support for Servlet 2.4 servlet request events."
  
  Revision  Changes    Path
  1.1                  jakarta-servletapi-5/src/share/javax/servlet/ServletRequestAttributeEvent.java
  
  Index: ServletRequestAttributeEvent.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   *
   * This source code implements specifications defined by the Java
   * Community Process. In order to remain compliant with the specification
   * DO NOT add / change / or delete method signatures!
   */
  
  package javax.servlet;
  
  
      /** 
        * This is the event class for notifications about changes to the 
        * attributes of the servlet request of a web application.
        * @see ServletRequestAttributeListener
        * @since	v 2.4
        */
  
  public class ServletRequestAttributeEvent extends ServletRequestEvent { 
      private String name;
      private Object value;
  
      /** Construct a ServletRequestAttributeEvent from the given context for the
        * given attribute name and attribute value. 
        *
        * @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 String - 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 Object - the value of the changed request attribute.
        */
      public Object getValue() {
          return this.value;   
      }
  }
  
  
  
  1.1                  jakarta-servletapi-5/src/share/javax/servlet/ServletRequestAttributeListener.java
  
  Index: ServletRequestAttributeListener.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
  "ServletContextListener.java" 81 lines, 3580 characters
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   *
   * This source code implements specifications defined by the Java
   * Community Process. In order to remain compliant with the specification
   * DO NOT add / change / or delete method signatures!
   */
  
  package javax.servlet;
  
  import java.util.EventListener;
  
      /** Implementations of this interface receive notifications of
        * changes to the attribute list on the servlet request of a 
        * web application. 
        * To receive notification events, the implementation class
        * must be configured in the deployment descriptor for the web application.
        * @see ServletRequestAttributeEvent
        * @since	v 2.4
       */
  
  public interface ServletRequestAttributeListener extends EventListener {
      /** Notification that a new attribute was added to the servlet request. Called after the attribute is added.*/
      public void attributeAdded(ServletRequestAttributeEvent srae);
  
      /** Notification that an existing attribute has been removed from the servlet request. Called after the attribute is removed.*/
      public void attributeRemoved(ServletRequestAttributeEvent srae);
  
      /** Notification that an attribute on the servlet request has been replaced. Called after the attribute is replaced. */
      public void attributeReplaced(ServletRequestAttributeEvent srae);
  }
  
  
  
  
  1.1                  jakarta-servletapi-5/src/share/javax/servlet/ServletRequestEvent.java
  
  Index: ServletRequestEvent.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   *
   * This source code implements specifications defined by the Java
   * Community Process. In order to remain compliant with the specification
   * DO NOT add / change / or delete method signatures!
   */
  
  package javax.servlet;
  
  
      /** 
        * This is the event class for notifications about changes to the 
        * servlet request of a web application.
        * @see ServletRequestListener
        * @since	v 2.4
        */
  
  public class ServletRequestEvent extends java.util.EventObject { 
      private ServletRequest request;
  
      /** Construct a ServletRequestEvent from the given context.
        *
        * @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;
      }
      
      /**
        * Return the ServletRequest that changed.
        *
        * @return the ServletRequest that sent the event.
        */
      public ServletRequest getServletRequest () { 
          return this.request;
      }
  
      /**
        * Return the ServletContext that changed.
        *
        * @return the ServletContext of the web application.
        */
      public ServletContext getServletContext () { 
          return (ServletContext) super.getSource();
      }
  }
  
  
  
  1.1                  jakarta-servletapi-5/src/share/javax/servlet/ServletRequestListener.java
  
  Index: ServletRequestListener.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   *
   * This source code implements specifications defined by the Java
   * Community Process. In order to remain compliant with the specification
   * DO NOT add / change / or delete method signatures!
   */
  
  package javax.servlet;
  
  import java.util.EventListener;
  
      /** 
        * Implementations of this interface recieve notifications about changes
        * to the servlet request of the web application they are part of.
        * To receive notification events, the implementation class
        * must be configured in the deployment descriptor for the web 
        * application.
        * @see ServletContextEvent
        * @since	v 2.4
        */
  
  public interface ServletRequestListener extends EventListener {
      /** Notification that the servlet request is about to go out of scope. */
      public void requestDestroyed ( ServletRequestEvent sre );
  
      /** Notification that the servlet request is about to go into scope.  */
      public void requestInitialized ( ServletRequestEvent sre );
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>