Java Code Examples for com.alibaba.dubbo.common.json.JSON#json()

The following examples show how to use com.alibaba.dubbo.common.json.JSON#json() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DubboUtil.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 调用方法
 *
 * @param c
 * @param method
 * @param fullUrl
 * @param args
 * @return
 * @throws java.lang.Exception
 */
public static Object invoke(Class c, Method method, String fullUrl, Object... args) throws Exception {
    DubboInvoker<?> invoker = (DubboInvoker<?>) PROTOCOL.refer(c, URL.valueOf(fullUrl));
    if (invoker.isAvailable()) {
        Invocation inv = new RpcInvocation(method, args);
        Result ret = invoker.invoke(inv);
        PROTOCOL.destroy();
        return JSON.json(ret.getValue());
    }
    return null;
}
 
Example 2
Source File: JsonObjectOutput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void writeObject(Object obj) throws IOException {
    JSON.json(obj, writer, writeClass);
    writer.println();
    writer.flush();
}
 
Example 3
Source File: JsonObjectOutput.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void writeObject(Object obj) throws IOException {
    JSON.json(obj, writer, writeClass);
    writer.println();
    writer.flush();
}
 
Example 4
Source File: JsonObjectOutput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void writeObject(Object obj) throws IOException {
    JSON.json(obj, writer, writeClass);
    writer.println();
    writer.flush();
}
 
Example 5
Source File: JsonObjectOutput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void writeObject(Object obj) throws IOException {
    JSON.json(obj, writer, writeClass);
    writer.println();
    writer.flush();
}