From 7eafc42e6b7b01d9dfd8d7f4f1e68969d3ace806 Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 10 Oct 2011 05:01:04 +0000 Subject: Use home-grown JSONRPC implementation git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1180780 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/jsonrpc/protocol/JsonRpc20Response.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/protocol/JsonRpc20Response.java') diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/protocol/JsonRpc20Response.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/protocol/JsonRpc20Response.java index df6f1b9f5b..e6f8282faf 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/protocol/JsonRpc20Response.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/protocol/JsonRpc20Response.java @@ -30,8 +30,16 @@ public class JsonRpc20Response extends JsonRpc20Result { this.result = result; } + public JsonRpc20Response(JSONObject response) { + super(response); + this.result = response.opt("result"); + } + public JSONObject toJSONObject() throws JSONException { - JSONObject response = new JSONObject(); + if (response != null) { + return response; + } + response = new JSONObject(); response.put("jsonrpc", "2.0"); response.put("id", id); response.put("result", result); -- cgit v1.2.3