List of usage examples for com.vaadin.server ServerRpcMethodInvocation ServerRpcMethodInvocation
public ServerRpcMethodInvocation(String connectorId, Class<? extends ServerRpc> interfaceClass, String methodName, int parameterCount)
From source file:org.semanticsoft.vaaclipse.app.servlet.VaaclipseServerRpcHandler.java
License:Open Source License
private ServerRpcMethodInvocation parseServerRpcInvocation(String connectorId, String interfaceName, String methodName, JSONArray parametersJson, ConnectorTracker connectorTracker) throws JSONException { ClientConnector connector = connectorTracker.getConnector(connectorId); ServerRpcManager<?> rpcManager = connector.getRpcManager(interfaceName); if (rpcManager == null) { /*/* www . j av a2s. c o m*/ * Security: Don't even decode the json parameters if no RpcManager * corresponding to the received method invocation has been * registered. */ getLogger().warning("Ignoring RPC call to " + interfaceName + "." + methodName + " in connector " + connector.getClass().getName() + "(" + connectorId + ") as no RPC implementation is registered"); return null; } // Use interface from RpcManager instead of loading the class based on // the string name to avoid problems with OSGi Class<? extends ServerRpc> rpcInterface = rpcManager.getRpcInterface(); ServerRpcMethodInvocation invocation = new ServerRpcMethodInvocation(connectorId, rpcInterface, methodName, parametersJson.length()); Object[] parameters = new Object[parametersJson.length()]; Type[] declaredRpcMethodParameterTypes = invocation.getMethod().getGenericParameterTypes(); for (int j = 0; j < parametersJson.length(); ++j) { Object parameterValue = parametersJson.get(j); Type parameterType = declaredRpcMethodParameterTypes[j]; parameters[j] = JsonCodec.decodeInternalOrCustomType(parameterType, parameterValue, connectorTracker); } invocation.setParameters(parameters); return invocation; }