KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > ServletRequestAttributeEvent


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */

17 package javax.servlet;
18
19
20     /**
21       * This is the event class for notifications of changes to the
22       * attributes of the servlet request in an application.
23       * @see ServletRequestAttributeListener
24       * @since Servlet 2.4
25       */

26
27 public class ServletRequestAttributeEvent extends ServletRequestEvent JavaDoc {
28     private String JavaDoc name;
29     private Object JavaDoc value;
30
31      /** Construct a ServletRequestAttributeEvent giving the servlet context
32       * of this web application, the ServletRequest whose attributes are
33       * changing and the name and value of the attribute.
34       *
35       * @param sc the ServletContext that is sending the event.
36       * @param request the ServletRequest that is sending the event.
37       * @param name the name of the request attribute.
38       * @param value the value of the request attribute.
39       */

40     public ServletRequestAttributeEvent(ServletContext JavaDoc sc, ServletRequest JavaDoc request, String JavaDoc name, Object JavaDoc value) {
41         super(sc, request);
42         this.name = name;
43         this.value = value;
44     }
45
46     /**
47       * Return the name of the attribute that changed on the ServletRequest.
48       *
49       * @return the name of the changed request attribute
50       */

51     public String JavaDoc getName() {
52         return this.name;
53     }
54
55     /**
56       * Returns the value of the attribute that has been added, removed or
57       * replaced. If the attribute was added, this is the value of the
58       * attribute. If the attribute was removed, this is the value of the
59       * removed attribute. If the attribute was replaced, this is the old
60       * value of the attribute.
61       *
62       * @return the value of the changed request attribute
63       */

64     public Object JavaDoc getValue() {
65         return this.value;
66     }
67 }
68
Popular Tags