001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    //
019    // This source code implements specifications defined by the Java
020    // Community Process. In order to remain compliant with the specification
021    // DO NOT add / change / or delete method signatures!
022    //
023    
024    package javax.servlet;
025    
026    /**
027     * This is the event class for notifications about changes to the attributes of the
028     * servlet context of a web application.
029     * @see ServletContextAttributeListener
030     * @since Servlet 2.3
031     *
032     * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
033     */
034    public class ServletContextAttributeEvent extends ServletContextEvent {
035        private String name;
036        private Object value;
037    
038        /**
039         * Construct a ServletContextAttributeEvent from the given context for the
040         * given attribute name and attribute value.
041         */
042        public ServletContextAttributeEvent(ServletContext source, String name, Object value) {
043            super(source);
044            this.name = name;
045            this.value = value;
046        }
047    
048        /**
049         * Return the name of the attribute that changed on the ServletContext.
050         */
051        public String getName() {
052            return this.name;
053        }
054    
055        /**
056         * Returns the value of the attribute that has been added, removed, or replaced.
057         * If the attribute was added, this is the value of the attribute. If the attrubute was
058         * removed, this is the value of the removed attribute. If the attribute was replaced, this
059         * is the old value of the attribute.
060         */
061        public Object getValue() {
062            return this.value;
063        }
064    }
065