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    package javax.servlet;
021    
022    
023            /** 
024            * This is the event class for notifications about changes to the attributes of the
025            *  servlet context of a web application.
026            * @see ServletContextAttributeListener
027             * @since       v 2.3
028            */
029    
030    public class ServletContextAttributeEvent extends ServletContextEvent { 
031            private String name;
032            private Object value;
033    
034            /** Construct a ServletContextAttributeEvent from the given context for the
035            ** given attribute name and attribute value. 
036            */
037            public ServletContextAttributeEvent(ServletContext source, String name, Object value) {
038                super(source);
039                this.name = name;
040                this.value = value;
041            }
042            
043            /**
044            * Return the name of the attribute that changed on the ServletContext.
045            *
046            */
047            public String getName() {
048                    return this.name;
049            }
050            
051            /**
052            * Returns the value of the attribute that has been added, removed, or replaced.
053            * If the attribute was added, this is the value of the attribute. If the attribute was
054            * removed, this is the value of the removed attribute. If the attribute was replaced, this
055            * is the old value of the attribute.
056            *
057            */
058            
059            public Object getValue() {
060                return this.value;   
061            }
062    }
063