# Class PojoMessageHandlerBase<T>

java.lang.Object
org.apache.tomcat.websocket.pojo.PojoMessageHandlerBase<T>

Type Parameters:
  `T` - The type of message to handle

All Implemented Interfaces:
  `WrappedMessageHandler`

Direct Known Subclasses:
  `PojoMessageHandlerPartialBase, PojoMessageHandlerWholeBase`

public abstract class PojoMessageHandlerBase<T> extends Object implements WrappedMessageHandler
Common implementation code for the POJO message handlers.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final boolean`
  `convert`
  Whether the message payload should be converted to the method parameter type.
  `protected final int`
  `indexPayload`
  The index in the params array where the payload is stored.
  `protected final int`
  `indexSession`
  The index in the params array where the session is stored.
  `protected final long`
  `maxMessageSize`
  The maximum message size supported by this handler.
  `protected final Method`
  `method`
  The method to invoke when a message is received.
  `protected final Object[]`
  `params`
  The parameter array used for method invocation.
  `protected final Object`
  `pojo`
  The POJO instance that contains the message handler method.
  `protected final Session`
  `session`
  The WebSocket session associated with this handler.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PojoMessageHandlerBase(Object pojo, Method method, Session session, Object[] params, int indexPayload, boolean convert, int indexSession, long maxMessageSize)`
  Constructs a new PojoMessageHandlerBase.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final long`
  `getMaxMessageSize()`
  Returns the maximum message size supported by this handler.
  `final MessageHandler`
  `getWrappedHandler()`
  Expose the POJO if it is a message handler so the Session is able to match requests to remove handlers if the original handler has been wrapped.
  `protected final void`
  `handlePojoMethodException(Throwable t)`
  `protected final void`
  `processResult(Object result)`
  Processes the result of a POJO message handler method invocation by sending it back to the remote endpoint.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### pojo

    protected final Object pojo
    The POJO instance that contains the message handler method.

  - ### method

    protected final Method method
    The method to invoke when a message is received.

  - ### session

    protected final Session session
    The WebSocket session associated with this handler.

  - ### params

    protected final Object[] params
    The parameter array used for method invocation.

  - ### indexPayload

    protected final int indexPayload
    The index in the params array where the payload is stored.

  - ### convert

    protected final boolean convert
    Whether the message payload should be converted to the method parameter type.

  - ### indexSession

    protected final int indexSession
    The index in the params array where the session is stored.

  - ### maxMessageSize

    protected final long maxMessageSize
    The maximum message size supported by this handler.

- ## Constructor Details

  - ### PojoMessageHandlerBase

    public PojoMessageHandlerBase(Object pojo, Method method, Session session, Object[] params, int indexPayload, boolean convert, int indexSession, long maxMessageSize)
    Constructs a new PojoMessageHandlerBase.
    Parameters:
      `pojo` - the POJO instance containing the message handler method
      `method` - the method to invoke when a message is received
      `session` - the WebSocket session
      `params` - the parameter array for method invocation
      `indexPayload` - the index in the params array for the payload
      `convert` - whether to convert the payload to the method parameter type
      `indexSession` - the index in the params array for the session
      `maxMessageSize` - the maximum message size

- ## Method Details

  - ### processResult

    protected final void processResult(Object result)
    Processes the result of a POJO message handler method invocation by sending it back to the remote endpoint.
    Parameters:
      `result` - the result object to send

  - ### getWrappedHandler

    public final MessageHandler getWrappedHandler()
    Expose the POJO if it is a message handler so the Session is able to match requests to remove handlers if the original handler has been wrapped.
    Specified by:
      `getWrappedHandler` in interface `WrappedMessageHandler`
    Returns:
      the wrapped message handler

  - ### getMaxMessageSize

    public final long getMaxMessageSize()
    Description copied from interface: `WrappedMessageHandler`
    Returns the maximum message size supported by this handler.
    Specified by:
      `getMaxMessageSize` in interface `WrappedMessageHandler`
    Returns:
      the maximum message size

  - ### handlePojoMethodException

    protected final void handlePojoMethodException(Throwable t)