/** * Creates a JSON notification from the given data. * Closes the `writer`. * * @param writer the writer * @throws IOException */ protected void toJson(Writer writer, String method, Object... params) throws IOException { JsonRpc rpc = JsonRpc.create(); rpc.setMethod(method); if (params.length > 0) { for (Object obj : params) { rpc.addParam(obj); } } JsonBeanEncoder.create(writer).writeObject(rpc).flush(); } }
/** * Creates a JSON notification from the given data. * Closes the `writer`. * * @param writer the writer * @throws IOException */ protected void toJson(Writer writer, String method, Object... params) throws IOException { JsonRpc rpc = JsonRpc.create(); rpc.setMethod(method); if (params.length > 0) { for (Object obj : params) { rpc.addParam(obj); } } JsonBeanEncoder.create(writer).writeObject(rpc).flush(); } }