summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-29 10:02:48 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-29 10:02:48 +0000
commit992d6ad55298632ebdd18633097536198f2d8eb1 (patch)
tree5dabce86c4459f0496b25e5777651955cc4a215c /sca-java-1.x
parent7cde257f3542a78622f4e6845363366b14a18899 (diff)
Remove commented out cruft
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1002551 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x')
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java22
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java72
2 files changed, 2 insertions, 92 deletions
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java
index 837a343a20..579ad7bee1 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java
@@ -66,12 +66,10 @@ public class JSONPInvoker implements Invoker {
public Message doInvoke(Message msg) throws JsonGenerationException, JsonMappingException, IOException, EncoderException {
String uri = binding.getURI() + "/" + operation.getName();
- //String[] jsonArgs = objectsToJSON((Object[])msg.getBody());
String[] jsonArgs = objectsToJSONStrings((Object[])msg.getBody());
String responseJSON = invokeHTTPRequest(uri, jsonArgs);
- //Object response = jsonToObjects(responseJSON)[0];
msg.setBody(responseJSON);
return msg;
@@ -142,18 +140,6 @@ public class JSONPInvoker implements Invoker {
return responseJSON.toString();
}
-
-/* Not required now JSON conversion is delegated to databinding
- protected String[] objectsToJSON(Object[] msgArgs) throws JsonGenerationException, JsonMappingException, IOException {
- String[] jsonArgs = new String[msgArgs.length];
- for (int i=0; i<msgArgs.length; i++) {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- mapper.writeValue(os , msgArgs[i]);
- jsonArgs[i] = os.toString();
- }
- return jsonArgs;
- }
-*/
protected String[] objectsToJSONStrings(Object[] msgArgs) throws JsonGenerationException, JsonMappingException, IOException {
String[] jsonArgs = new String[msgArgs.length];
@@ -162,13 +148,5 @@ public class JSONPInvoker implements Invoker {
}
return jsonArgs;
}
-
-/* Not required now JSON conversion is delegated to databinding
- protected Object[] jsonToObjects(String jsonRequest) throws JsonParseException, JsonMappingException, IOException {
- Class<?> c = new Object[0].getClass();
- Object[] args = (Object[])mapper.readValue("[" + jsonRequest +"]", c);
- return args;
- }
-*/
}
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java
index 17968dfa67..a86446c734 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java
@@ -69,51 +69,12 @@ public class JSONPServlet extends GenericServlet {
@Override
public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
- //String jsonRequest = getJSONRequest(servletRequest);
- //Object[] args = jsonToObjects(jsonRequest);
Object[] args = getJSONRequestStringArray(servletRequest);
Object response = invokeService(args);
- //String jsonResponse = getJSONResponse(servletRequest, response);
String jsonResponse = getJSONResponseAsString(servletRequest, response);
servletResponse.getOutputStream().println(jsonResponse);
}
-
- /**
- * Turn the request into JSON
- */
-/* Not required now JSON conversion is delegated to databinding
- protected String getJSONRequest(ServletRequest servletRequest) throws IOException, JsonParseException, JsonMappingException {
-
- List<DataType> types = operation.getInputType().getLogical();
- int typesIndex = 0;
-
- String jsonRequest = "";
- for (String name : getOrderedParameterNames(servletRequest)) {
- if (!name.startsWith("_") && !"callback".equals(name)) {
- if (jsonRequest.length() > 1) {
- jsonRequest += ", ";
- }
-
- // automatically quote string parammeters so clients work in the usual javascript way
- if (typesIndex < types.size() && String.class.equals(types.get(typesIndex).getGenericType())) {
- String x = servletRequest.getParameter(name);
- // TODO: do this more properly
- if (!x.startsWith("\"")) {
- jsonRequest += "\"" + x + "\"";
- } else {
- jsonRequest += x;
- }
- } else {
- jsonRequest += servletRequest.getParameter(name);
- }
-
- }
- }
-
- return "[" + jsonRequest + "]";
- }
-*/
-
+
/**
* Turn the request into a string array of JSON structures. The Databinding
* layer will then convert each of the individual parameters into the appropriate
@@ -176,24 +137,6 @@ public class JSONPServlet extends GenericServlet {
return sortedNames;
}
-
- /**
- * Turn the response object into JSON
- */
-/* Not required now JSON conversion is delegated to databinding
- protected String getJSONResponse(ServletRequest servletRequest, Object response) throws IOException, JsonParseException {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- mapper.writeValue(os , response);
- String jsonResponse = os.toString();
-
- String callback = servletRequest.getParameter("callback");
- if (callback != null && callback.length() > 1) {
- jsonResponse = callback + "(" + jsonResponse + ");";
- }
-
- return jsonResponse;
- }
-*/
/**
* The databinding layer will have converterted the return type into a JSON string so simply
@@ -209,18 +152,7 @@ public class JSONPServlet extends GenericServlet {
return jsonResponse;
}
-
- /**
- * Turn the request JSON into objects
- */
-/* Not required now JSON conversion is delegated to databinding
- protected Object[] jsonToObjects(String jsonRequest) throws IOException, JsonParseException, JsonMappingException {
- Class<?> c = new Object[0].getClass();
- Object[] args = (Object[])mapper.readValue(jsonRequest, c);
- return args;
- }
-*/
-
+
/**
* Send the request down the wire to invoke the service