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.

This commit is contained in:
Kris McQueen 2010-09-29 17:32:19 -07:00
parent da660f2575
commit 0105aec338
3 changed files with 4 additions and 3 deletions

View File

@ -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 {

View File

@ -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() + "\"");
}
}
}

View File

@ -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());