Class ServerRpcHandler

  • All Implemented Interfaces:
    java.io.Serializable

    public class ServerRpcHandler
    extends java.lang.Object
    implements java.io.Serializable
    Handles a client-to-server message containing serialized server RPC invocations.
    Since:
    7.1
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ServerRpcHandler.RpcRequest
      A data transfer object representing an RPC request sent by the client side.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void changeVariables​(java.lang.Object source, VariableOwner owner, java.util.Map<java.lang.String,​java.lang.Object> m)  
      static java.lang.String getIgnoredDisabledError​(java.lang.String what, ClientConnector connector)
      Generates an error message when the client is trying to do something ('what') with a connector which is disabled or invisible.
      protected java.lang.String getMessage​(java.io.Reader reader)  
      protected void handleInvocation​(UI ui, ClientConnector connector, ServerRpcMethodInvocation invocation)
      Handles the given RPC method invocation for the given connector.
      protected void handleInvocation​(UI ui, ClientConnector connector, com.vaadin.shared.communication.LegacyChangeVariablesInvocation legacyInvocation)
      Handles the given Legacy variable change RPC method invocation for the given connector.
      protected void handleInvocations​(UI ui, int lastSyncIdSeenByClient, elemental.json.JsonArray invocationsData)
      Processes invocations data received from the client.
      void handleRpc​(UI ui, java.io.Reader reader, VaadinRequest request)
      Reads JSON containing zero or more serialized RPC calls (including legacy variable changes) and executes the calls.
      • Methods inherited from class java.lang.Object

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

      • ServerRpcHandler

        public ServerRpcHandler()
    • Method Detail

      • handleInvocations

        protected void handleInvocations​(UI ui,
                                         int lastSyncIdSeenByClient,
                                         elemental.json.JsonArray invocationsData)
        Processes invocations data received from the client.

        The invocations data can contain any number of RPC calls, including legacy variable change calls that are processed separately.

        Consecutive changes to the value of the same variable are combined and changeVariables() is only called once for them. This preserves the Vaadin 6 semantics for components and add-ons that do not use Vaadin 7 RPC directly.

        Parameters:
        ui - the UI receiving the invocations data
        lastSyncIdSeenByClient - the most recent sync id the client has seen at the time the request was sent
        invocationsData - JSON containing all information needed to execute all requested RPC calls.
        Since:
        7.7
      • handleInvocation

        protected void handleInvocation​(UI ui,
                                        ClientConnector connector,
                                        ServerRpcMethodInvocation invocation)
        Handles the given RPC method invocation for the given connector.
        Parameters:
        ui - the UI containing the connector
        connector - the connector the RPC is targeted to
        invocation - information about the rpc to invoke
        Since:
        7.7
      • handleInvocation

        protected void handleInvocation​(UI ui,
                                        ClientConnector connector,
                                        com.vaadin.shared.communication.LegacyChangeVariablesInvocation legacyInvocation)
        Handles the given Legacy variable change RPC method invocation for the given connector.
        Parameters:
        ui - the UI containing the connector
        connector - the connector the RPC is targeted to
        legacyInvocation - information about the rpc to invoke
        Since:
        7.7
      • changeVariables

        protected void changeVariables​(java.lang.Object source,
                                       VariableOwner owner,
                                       java.util.Map<java.lang.String,​java.lang.Object> m)
      • getMessage

        protected java.lang.String getMessage​(java.io.Reader reader)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getIgnoredDisabledError

        public static java.lang.String getIgnoredDisabledError​(java.lang.String what,
                                                               ClientConnector connector)
        Generates an error message when the client is trying to do something ('what') with a connector which is disabled or invisible.
        Parameters:
        what - the ignored operation
        connector - the connector which is disabled (or invisible)
        Returns:
        an error message
        Since:
        7.1.8