Package com.vaadin.server.communication
Class ServerRpcHandler
- java.lang.Object
-
- com.vaadin.server.communication.ServerRpcHandler
-
- All Implemented Interfaces:
Serializable
public class ServerRpcHandler extends Object implements Serializable
Handles a client-to-server message containing serializedserver 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.
-
Constructor Summary
Constructors Constructor Description ServerRpcHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
changeVariables(Object source, VariableOwner owner, Map<String,Object> m)
static String
getIgnoredDisabledError(String what, ClientConnector connector)
Generates an error message when the client is trying to to something ('what') with a connector which is disabled or invisible.protected String
getMessage(Reader reader)
protected void
handleInvocation(UI ui, ClientConnector connector, ServerRpcMethodInvocation invocation)
Handles the given RPC method invocation for the given connectorprotected void
handleInvocation(UI ui, ClientConnector connector, LegacyChangeVariablesInvocation legacyInvocation)
Handles the given Legacy variable change RPC method invocation for the given connectorprotected void
handleInvocations(UI ui, int lastSyncIdSeenByClient, JsonArray invocationsData)
Processes invocations data received from the client.void
handleRpc(UI ui, Reader reader, VaadinRequest request)
Reads JSON containing zero or more serialized RPC calls (including legacy variable changes) and executes the calls.
-
-
-
Method Detail
-
handleRpc
public void handleRpc(UI ui, Reader reader, VaadinRequest request) throws IOException, LegacyCommunicationManager.InvalidUIDLSecurityKeyException
Reads JSON containing zero or more serialized RPC calls (including legacy variable changes) and executes the calls.- Parameters:
ui
- TheUI
receiving the calls. Cannot be null.reader
- TheReader
used to read the JSON.request
-- Throws:
IOException
- If reading the message fails.LegacyCommunicationManager.InvalidUIDLSecurityKeyException
- If the received security key does not match the one stored in the session.
-
handleInvocations
protected void handleInvocations(UI ui, int lastSyncIdSeenByClient, 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 datalastSyncIdSeenByClient
- the most recent sync id the client has seen at the time the request was sentinvocationsData
- 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 connectorconnector
- the connector the RPC is targeted toinvocation
- information about the rpc to invoke- Since:
- 7.7
-
handleInvocation
protected void handleInvocation(UI ui, ClientConnector connector, LegacyChangeVariablesInvocation legacyInvocation)
Handles the given Legacy variable change RPC method invocation for the given connector- Parameters:
ui
- the UI containing the connectorconnector
- the connector the RPC is targeted toinvocation
- information about the rpc to invoke- Since:
- 7.7
-
changeVariables
protected void changeVariables(Object source, VariableOwner owner, Map<String,Object> m)
-
getMessage
protected String getMessage(Reader reader) throws IOException
- Throws:
IOException
-
getIgnoredDisabledError
public static String getIgnoredDisabledError(String what, ClientConnector connector)
Generates an error message when the client is trying to to something ('what') with a connector which is disabled or invisible.- Parameters:
connector
- the connector which is disabled (or invisible)- Returns:
- an error message
- Since:
- 7.1.8
-
-