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