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 * Events of this kind indicate lifecycle 021 * events for a ServletRequest. 022 * The source of the event 023 * is the ServletContext of this web application. 024 * @see ServletRequestListener 025 * @since Servlet 2.4 026 */ 027 028 public class ServletRequestEvent extends java.util.EventObject { 029 private ServletRequest request; 030 031 /** Construct a ServletRequestEvent for the given ServletContext 032 * and ServletRequest. 033 * 034 * @param sc the ServletContext of the web application. 035 * @param request the ServletRequest that is sending the event. 036 */ 037 public ServletRequestEvent(ServletContext sc, ServletRequest request) { 038 super(sc); 039 this.request = request; 040 } 041 042 /** 043 * Returns the ServletRequest that is changing. 044 */ 045 public ServletRequest getServletRequest () { 046 return this.request; 047 } 048 049 /** 050 * Returns the ServletContext of this web application. 051 */ 052 public ServletContext getServletContext () { 053 return (ServletContext) super.getSource(); 054 } 055 }