@Override public <T> void call(final URI url, final Method method, final Object[] params, final AsyncCallback<T> callback) throws IOException { final JSONRequest message = new JSONRequest(method, params, callback); transport.send(url, protocolStack.outbound(message, url).result, null); }
@Override public <T> void call(final URI url, final String method, final ObjectNode params, final AsyncCallback<T> callback) throws IOException { final JSONRequest message = new JSONRequest(method, params, callback); transport.send(url, protocolStack.outbound(message, url).result, null); }
/** * Schedule an RPC call at a specified due time. * * @param method * the method * @param params * the params * @param due * the due * @return the string */ @Access(AccessType.UNAVAILABLE) protected String schedule(final String method, final ObjectNode params, final DateTime due) { final Scheduler scheduler = this.scheduler; if (scheduler == null) return ""; return scheduler.schedule(new JSONRequest(method, params), due); }
/** * Schedule an RPC call at a specified due time. * * @param method * the method * @param params * the params * @param delay * the delay * @return the string */ @Access(AccessType.UNAVAILABLE) protected String schedule(final String method, final ObjectNode params, final int delay) { final Scheduler scheduler = this.scheduler; if (scheduler == null) return ""; return scheduler.schedule(new JSONRequest(method, params), delay); }
/** * Schedule an RPC call at a specified due time. * * @param method * the method * @param params * the params * @param delay * the delay * @return the string */ @Access(AccessType.UNAVAILABLE) protected String schedule(final String method, final ObjectNode params, final long delay) { final Scheduler scheduler = this.scheduler; if (scheduler == null) return ""; return scheduler.schedule(new JSONRequest(method, params), delay); }
@Override public <T> T callSync(final URI url, final String method, final ObjectNode params, final TypeUtil<T> type) throws IOException { final SyncCallback<T> callback = new SyncCallback<T>(type) {}; final JSONRequest message = new JSONRequest(method, params, callback); transport.send(url, protocolStack.outbound(message, url).result, null); try { return callback.get(); } catch (final Exception e) { throw new IOException(e); } } }
jsonMsg = response; } else if (JSONRpc.isRequest(json)) { final JSONRequest request = new JSONRequest(json); jsonMsg = request; } else {
/** * Invoke a method on an object. * * @param destination * the destination * @param request * A request in JSON-RPC format * @param requestParams * Optional request parameters * @param auth * the auth * @return the string * @throws IOException * Signals that an I/O exception has occurred. */ public static String invoke(final Object destination, final String request, final RequestParams requestParams, final Authorizor auth) throws IOException { JSONRequest jsonRequest = null; JSONResponse jsonResponse = null; try { jsonRequest = new JSONRequest(request); jsonResponse = invoke(destination, jsonRequest, requestParams, auth); } catch (final JSONRPCException err) { jsonResponse = new JSONResponse(err); } return jsonResponse.toString(); }