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