Class PojoMessageHandlerBase<T>

    • Field Summary

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

      Constructors 
      Constructor Description
      PojoMessageHandlerBase​(java.lang.Object pojo, java.lang.reflect.Method method, Session session, java.lang.Object[] params, int indexPayload, boolean convert, int indexSession, long maxMessageSize)
      Constructs a new PojoMessageHandlerBase.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getMaxMessageSize()
      Returns the maximum message size supported by this handler.
      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 void handlePojoMethodException​(java.lang.Throwable t)  
      protected void processResult​(java.lang.Object result)
      Processes the result of a POJO message handler method invocation by sending it back to the remote endpoint.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pojo

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

        protected final java.lang.reflect.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 java.lang.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 Detail

      • PojoMessageHandlerBase

        public PojoMessageHandlerBase​(java.lang.Object pojo,
                                      java.lang.reflect.Method method,
                                      Session session,
                                      java.lang.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 Detail

      • processResult

        protected final void processResult​(java.lang.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
      • handlePojoMethodException

        protected final void handlePojoMethodException​(java.lang.Throwable t)