01 /*
02 * Copyright 2004 The Apache Software Foundation
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package javax.servlet;
17
18 /**
19 * This is the event class for notifications of changes to the
20 * attributes of the servlet request in an application.
21 * @see ServletRequestAttributeListener
22 * @since Servlet 2.4
23 */
24
25 public class ServletRequestAttributeEvent extends ServletRequestEvent {
26 private String name;
27 private Object value;
28
29 /** Construct a ServletRequestAttributeEvent giving the servlet context
30 * of this web application, the ServletRequest whose attributes are
31 * changing and the name and value of the attribute.
32 *
33 * @param sc the ServletContext that is sending the event.
34 * @param request the ServletRequest that is sending the event.
35 * @param name the name of the request attribute.
36 * @param value the value of the request attribute.
37 */
38 public ServletRequestAttributeEvent(ServletContext sc,
39 ServletRequest request, String name, Object value) {
40 super (sc, request);
41 this .name = name;
42 this .value = value;
43 }
44
45 /**
46 * Return the name of the attribute that changed on the ServletRequest.
47 *
48 * @return the name of the changed request attribute
49 */
50 public String getName() {
51 return this .name;
52 }
53
54 /**
55 * Returns the value of the attribute that has been added, removed or
56 * replaced. If the attribute was added, this is the value of the
57 * attribute. If the attribute was removed, this is the value of the
58 * removed attribute. If the attribute was replaced, this is the old
59 * value of the attribute.
60 *
61 * @return the value of the changed request attribute
62 */
63 public Object getValue() {
64 return this.value;
65 }
66 }
|