ServletRequestEvent (Servlet 4.0 API Documentation - Apache Tomcat 9.0.111)
Description: declaration: package: javax.servlet, class: ServletRequestEvent

# Class ServletRequestEvent

java.lang.Object
java.util.EventObject
javax.servlet.ServletRequestEvent

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `ServletRequestAttributeEvent`

public class ServletRequestEvent extends EventObject
Events of this kind indicate lifecycle events for a ServletRequest. The source of the event is the ServletContext of this web application.

Since:
  Servlet 2.4
See Also:
  - `ServletRequestListener`
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class EventObject

  `source`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServletRequestEvent(ServletContext sc, ServletRequest request)`
  Construct a ServletRequestEvent for the given ServletContext and ServletRequest.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ServletContext`
  `getServletContext()`
  Get the associated ServletContext.
  `ServletRequest`
  `getServletRequest()`
  Get the associated ServletRequest.

  ### Methods inherited from class EventObject

  `getSource, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ServletRequestEvent

    public ServletRequestEvent(ServletContext sc, ServletRequest request)
    Construct a ServletRequestEvent for the given ServletContext and ServletRequest.
    Parameters:
      `sc` - the ServletContext of the web application.
      `request` - the ServletRequest that is sending the event.

- ## Method Details

  - ### getServletRequest

    public ServletRequest getServletRequest()
    Get the associated ServletRequest.
    Returns:
      the ServletRequest that is changing.

  - ### getServletContext

    public ServletContext getServletContext()
    Get the associated ServletContext.
    Returns:
      the ServletContext that is changing.