Skip to content

Commit 85aa3a9

Browse files
committed
Revert "api: Include cloudstack-version in both xml and json api response"
This reverts commit f8a483f. Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 0f130e1 commit 85aa3a9

3 files changed

Lines changed: 10 additions & 18 deletions

File tree

api/src/org/apache/cloudstack/api/BaseCmd.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ public String buildResponse(ServerApiException apiException, String responseType
289289
StringBuffer sb = new StringBuffer();
290290
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
291291
// JSON response
292-
sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
292+
sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
293293
sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
294294
} else {
295295
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
296296
sb.append("<" + getCommandName() + ">");
297297
sb.append("<errorcode>" + apiException.getErrorCode() + "</errorcode>");
298298
sb.append("<description>" + escapeXml(apiException.getDescription()) + "</description>");
299-
sb.append("</" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
299+
sb.append("</" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
300300
}
301301
return sb.toString();
302302
}
@@ -307,10 +307,10 @@ public String buildResponse(List<Pair<String, Object>> tagList, String responseT
307307

308308
// set up the return value with the name of the response
309309
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
310-
prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
310+
prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
311311
} else {
312312
prefixSb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
313-
prefixSb.append("<" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
313+
prefixSb.append("<" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
314314
}
315315

316316
int i = 0;

server/src/com/cloud/api/ApiServlet.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,10 @@ private String getLoginSuccessResponse(HttpSession session, String responseType)
402402
}
403403
}
404404
}
405-
sb.append(" }");
406-
sb.append(", \"cloudstack-version\": \"");
407-
sb.append(ApiDBUtils.getVersion());
408-
sb.append("\" }");
405+
sb.append(" } }");
409406
} else {
410407
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
411-
sb.append("<loginresponse cloudstack-version=\"" + ApiDBUtils.getVersion() + "\">");
408+
sb.append("<loginresponse cloud-stack-version=\"" + ApiDBUtils.getVersion() + "\">");
412409
sb.append("<timeout>" + inactiveInterval + "</timeout>");
413410
Enumeration attrNames = session.getAttributeNames();
414411
if (attrNames != null) {
@@ -435,13 +432,10 @@ private String getLoginSuccessResponse(HttpSession session, String responseType)
435432
private String getLogoutSuccessResponse(String responseType) {
436433
StringBuffer sb = new StringBuffer();
437434
if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
438-
sb.append("{ \"logoutresponse\" : { \"description\" : \"success\" }");
439-
sb.append(", \"cloudstack-version\": \"");
440-
sb.append(ApiDBUtils.getVersion());
441-
sb.append("\" }");
435+
sb.append("{ \"logoutresponse\" : { \"description\" : \"success\" } }");
442436
} else {
443437
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
444-
sb.append("<logoutresponse cloudstack-version=\"" + ApiDBUtils.getVersion() + "\">");
438+
sb.append("<logoutresponse cloud-stack-version=\"" + ApiDBUtils.getVersion() + "\">");
445439
sb.append("<description>success</description>");
446440
sb.append("</logoutresponse>");
447441
}

server/src/com/cloud/api/response/ApiResponseSerializer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ public static String toJSONSerializedString(ResponseObject result) {
122122
sb.append("{ }");
123123
}
124124
}
125-
sb.append(", \"cloudstack-version\": \"");
126-
sb.append(ApiDBUtils.getVersion());
127-
sb.append("\" }");
125+
sb.append(" }");
128126
return sb.toString();
129127
}
130128
return null;
@@ -133,7 +131,7 @@ public static String toJSONSerializedString(ResponseObject result) {
133131
private static String toXMLSerializedString(ResponseObject result) {
134132
StringBuilder sb = new StringBuilder();
135133
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
136-
sb.append("<").append(result.getResponseName()).append(" cloudstack-version=\"").append(ApiDBUtils.getVersion()).append("\">");
134+
sb.append("<").append(result.getResponseName()).append(" cloud-stack-version=\"").append(ApiDBUtils.getVersion()).append("\">");
137135

138136
if (result instanceof ListResponse) {
139137
Integer count = ((ListResponse) result).getCount();

0 commit comments

Comments
 (0)