WsSessionListener (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.tomcat.websocket.server, record: WsSessionListener

# Record Class WsSessionListener

java.lang.Object
java.lang.Record
org.apache.tomcat.websocket.server.WsSessionListener

Record Components:
  `wsServerContainer` - the server container

All Implemented Interfaces:
  `HttpSessionListener, EventListener`

public record WsSessionListener(WsServerContainer wsServerContainer) extends Record implements HttpSessionListener
Listener for HTTP session events to manage authenticated WebSocket sessions.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WsSessionListener(WsServerContainer wsServerContainer)`
  Creates an instance of a `WsSessionListener` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `void`
  `sessionDestroyed(HttpSessionEvent se)`
  Notification that a session is about to be invalidated.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `WsServerContainer`
  `wsServerContainer()`
  Returns the value of the `wsServerContainer` record component.

  ### Methods inherited from class Object

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

  ### Methods inherited from interface HttpSessionListener

  `sessionCreated`

- ## Constructor Details

  - ### WsSessionListener

    public WsSessionListener(WsServerContainer wsServerContainer)
    Creates an instance of a `WsSessionListener` record class.
    Parameters:
      `wsServerContainer` - the value for the `wsServerContainer` record component

- ## Method Details

  - ### sessionDestroyed

    public void sessionDestroyed(HttpSessionEvent se)
    Description copied from interface: `jakarta.servlet.http.HttpSessionListener`
    Notification that a session is about to be invalidated. The default implementation is a NO-OP.
    Specified by:
      `sessionDestroyed` in interface `HttpSessionListener`
    Parameters:
      `se` - the notification event

  - ### toString

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with `Objects::equals(Object,Object)`.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### wsServerContainer

    public WsServerContainer wsServerContainer()
    Returns the value of the `wsServerContainer` record component.
    Returns:
      the value of the `wsServerContainer` record component