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 * Events of this kind indicate lifecycle
20 * events for a ServletRequest.
21 * The source of the event
22 * is the ServletContext of this web application.
23 * @see ServletRequestListener
24 * @since Servlet 2.4
25 */
26
27 public class ServletRequestEvent extends java.util.EventObject {
28 private ServletRequest request;
29
30 /** Construct a ServletRequestEvent for the given ServletContext
31 * and ServletRequest.
32 *
33 * @param sc the ServletContext of the web application.
34 * @param request the ServletRequest that is sending the event.
35 */
36 public ServletRequestEvent(ServletContext sc, ServletRequest request) {
37 super (sc);
38 this .request = request;
39 }
40
41 /**
42 * Returns the ServletRequest that is changing.
43 */
44 public ServletRequest getServletRequest() {
45 return this .request;
46 }
47
48 /**
49 * Returns the ServletContext of this web application.
50 */
51 public ServletContext getServletContext() {
52 return (ServletContext) super.getSource();
53 }
54 }
|