|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.api.response; |
18 | 18 |
|
19 | | -import java.lang.reflect.Field; |
20 | | -import java.lang.reflect.Modifier; |
21 | | -import java.util.ArrayList; |
22 | | -import java.util.Arrays; |
23 | | -import java.util.Collection; |
24 | | -import java.util.Date; |
25 | | -import java.util.List; |
26 | | -import java.util.regex.Matcher; |
27 | | -import java.util.regex.Pattern; |
28 | | - |
29 | | -import org.apache.log4j.Logger; |
30 | | - |
| 19 | +import com.cloud.api.ApiDBUtils; |
| 20 | +import com.cloud.api.ApiResponseGsonHelper; |
| 21 | +import com.cloud.api.ApiServer; |
| 22 | +import com.cloud.serializer.Param; |
| 23 | +import com.cloud.user.Account; |
| 24 | +import com.cloud.utils.encoding.URLEncoder; |
| 25 | +import com.cloud.utils.exception.CloudRuntimeException; |
| 26 | +import com.cloud.utils.exception.ExceptionProxyObject; |
31 | 27 | import com.google.gson.Gson; |
32 | 28 | import com.google.gson.annotations.SerializedName; |
33 | | - |
34 | 29 | import org.apache.cloudstack.acl.RoleType; |
35 | 30 | import org.apache.cloudstack.api.ApiConstants; |
36 | 31 | import org.apache.cloudstack.api.BaseCmd; |
37 | 32 | import org.apache.cloudstack.api.ResponseObject; |
38 | 33 | import org.apache.cloudstack.api.response.AsyncJobResponse; |
| 34 | +import org.apache.cloudstack.api.response.AuthenticationCmdResponse; |
39 | 35 | import org.apache.cloudstack.api.response.CreateCmdResponse; |
40 | 36 | import org.apache.cloudstack.api.response.ExceptionResponse; |
41 | 37 | import org.apache.cloudstack.api.response.ListResponse; |
42 | 38 | import org.apache.cloudstack.api.response.SuccessResponse; |
43 | 39 | import org.apache.cloudstack.context.CallContext; |
| 40 | +import org.apache.log4j.Logger; |
44 | 41 |
|
45 | | -import com.cloud.api.ApiDBUtils; |
46 | | -import com.cloud.api.ApiResponseGsonHelper; |
47 | | -import com.cloud.api.ApiServer; |
48 | | -import com.cloud.serializer.Param; |
49 | | -import com.cloud.user.Account; |
50 | | -import com.cloud.utils.encoding.URLEncoder; |
51 | | -import com.cloud.utils.exception.CloudRuntimeException; |
52 | | -import com.cloud.utils.exception.ExceptionProxyObject; |
| 42 | +import java.lang.reflect.Field; |
| 43 | +import java.lang.reflect.Modifier; |
| 44 | +import java.util.ArrayList; |
| 45 | +import java.util.Arrays; |
| 46 | +import java.util.Collection; |
| 47 | +import java.util.Date; |
| 48 | +import java.util.List; |
| 49 | +import java.util.regex.Matcher; |
| 50 | +import java.util.regex.Pattern; |
53 | 51 |
|
54 | 52 | public class ApiResponseSerializer { |
55 | 53 | private static final Logger s_logger = Logger.getLogger(ApiResponseSerializer.class.getName()); |
@@ -120,7 +118,7 @@ public static String toJSONSerializedString(ResponseObject result) { |
120 | 118 | String jsonStr = gson.toJson(result); |
121 | 119 | if ((jsonStr != null) && !"".equals(jsonStr)) { |
122 | 120 | jsonStr = unescape(jsonStr); |
123 | | - if (result instanceof AsyncJobResponse || result instanceof CreateCmdResponse) { |
| 121 | + if (result instanceof AsyncJobResponse || result instanceof CreateCmdResponse || result instanceof AuthenticationCmdResponse) { |
124 | 122 | sb.append(jsonStr); |
125 | 123 | } else { |
126 | 124 | sb.append(" { \"").append(result.getObjectName()).append("\" : ").append(jsonStr).append(" } "); |
@@ -153,7 +151,7 @@ private static String toXMLSerializedString(ResponseObject result) { |
153 | 151 | } |
154 | 152 | } |
155 | 153 | } else { |
156 | | - if (result instanceof CreateCmdResponse || result instanceof AsyncJobResponse) { |
| 154 | + if (result instanceof CreateCmdResponse || result instanceof AsyncJobResponse || result instanceof AuthenticationCmdResponse) { |
157 | 155 | serializeResponseObjFieldsXML(sb, result); |
158 | 156 | } else { |
159 | 157 | serializeResponseObjXML(sb, result); |
|
0 commit comments