PojoEndpointBase (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.websocket.pojo, class: PojoEndpointBase

# Class PojoEndpointBase

java.lang.Object
javax.websocket.Endpoint
org.apache.tomcat.websocket.pojo.PojoEndpointBase

Direct Known Subclasses:
  `PojoEndpointClient, PojoEndpointServer`

public abstract class PojoEndpointBase extends Endpoint
Base implementation (client and server have different concrete implementations) of the wrapper that converts a POJO instance into a WebSocket endpoint instance.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `PojoEndpointBase(Map<String,String> pathParameters)`
  Constructs a new PojoEndpointBase.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected final void`
  `doOnOpen(Session session, EndpointConfig config)`
  Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.
  `protected PojoMethodMapping`
  `getMethodMapping()`
  Returns the method mapping for this endpoint.
  `protected Object`
  `getPojo()`
  Returns the POJO instance wrapped by this endpoint.
  `final void`
  `onClose(Session session, CloseReason closeReason)`
  Event that is triggered when a session has closed.
  `final void`
  `onError(Session session, Throwable throwable)`
  Event that is triggered when a protocol error occurs.
  `protected void`
  `setMethodMapping(PojoMethodMapping methodMapping)`
  Sets the method mapping for this endpoint.
  `protected void`
  `setPojo(Object pojo)`
  Sets the POJO instance wrapped by this endpoint.

  ### Methods inherited from class Endpoint

  `onOpen`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### PojoEndpointBase

    protected PojoEndpointBase(Map<String,String> pathParameters)
    Constructs a new PojoEndpointBase.
    Parameters:
      `pathParameters` - the path parameters for the endpoint

- ## Method Details

  - ### doOnOpen

    protected final void doOnOpen(Session session, EndpointConfig config)
    Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.
    Parameters:
      `session` - the WebSocket session
      `config` - the endpoint configuration

  - ### onClose

    public final void onClose(Session session, CloseReason closeReason)
    Description copied from class: `javax.websocket.Endpoint`
    Event that is triggered when a session has closed.
    Overrides:
      `onClose` in class `Endpoint`
    Parameters:
      `session` - The session
      `closeReason` - Why the session was closed

  - ### onError

    public final void onError(Session session, Throwable throwable)
    Description copied from class: `javax.websocket.Endpoint`
    Event that is triggered when a protocol error occurs.
    Overrides:
      `onError` in class `Endpoint`
    Parameters:
      `session` - The session.
      `throwable` - The exception.

  - ### getPojo

    protected Object getPojo()
    Returns the POJO instance wrapped by this endpoint.
    Returns:
      the POJO instance

  - ### setPojo

    protected void setPojo(Object pojo)
    Sets the POJO instance wrapped by this endpoint.
    Parameters:
      `pojo` - the POJO instance

  - ### getMethodMapping

    protected PojoMethodMapping getMethodMapping()
    Returns the method mapping for this endpoint.
    Returns:
      the method mapping

  - ### setMethodMapping

    protected void setMethodMapping(PojoMethodMapping methodMapping)
    Sets the method mapping for this endpoint.
    Parameters:
      `methodMapping` - the method mapping