From 0105aec3382602af8d9bd6c2700a821e1c3c5f12 Mon Sep 17 00:00:00 2001 From: Kris McQueen Date: Wed, 29 Sep 2010 17:32:19 -0700 Subject: [PATCH] Always set the response type on the command object so that the correct output is generated. Add both Strings and Longs to the login response (domainId and userId will be the Longs). Use the correct method name for ListSystemVMsCmd. --- server/src/com/cloud/api/ApiServer.java | 1 + server/src/com/cloud/api/ApiServlet.java | 4 ++-- server/src/com/cloud/api/commands/ListSystemVMsCmd.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index c9634ce3f64..c8041776897 100644 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -324,6 +324,7 @@ public class ApiServer implements HttpRequestHandler { Class cmdClass = Class.forName(cmdClassName); BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance(); + cmdObj.setResponseType(responseType); // This is where the command is either serialized, or directly dispatched response = queueCommand(cmdObj, paramMap); } else { diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java index f92a9d61d21..a4d11c568ae 100644 --- a/server/src/com/cloud/api/ApiServlet.java +++ b/server/src/com/cloud/api/ApiServlet.java @@ -285,8 +285,8 @@ public class ApiServlet extends HttpServlet { while (attrNames.hasMoreElements()) { String attrName = (String)attrNames.nextElement(); Object attrObj = session.getAttribute(attrName); - if (attrObj instanceof String) { - sb.append(", \"" + attrName + "\" : \"" + (String)attrObj + "\""); + if ((attrObj instanceof String) || (attrObj instanceof Long)) { + sb.append(", \"" + attrName + "\" : \"" + attrObj.toString() + "\""); } } } diff --git a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java index c50e1a886af..b2331872fd5 100644 --- a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java +++ b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java @@ -35,7 +35,7 @@ import com.cloud.vm.SecondaryStorageVmVO; import com.cloud.vm.SystemVm; import com.cloud.vm.VMInstanceVO; -@Implementation(method="searchForSystemVms") +@Implementation(method="searchForSystemVm") public class ListSystemVMsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName());