cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nitin Mehta <Nitin.Me...@citrix.com>
Subject RE: [PATCH] CS-14345 Logout API is not returning XML header Description: The logout API is not returning the standard XML header and the CloudStack version.
Date Mon, 04 Jun 2012 11:51:50 GMT
Code change looks good except the initialization of management service which should be done
inside ApiServlet().
Also if it is a static variable then append 's' before the name as per naming conventions
rule 7 @ http://docs.cloudstack.org/CloudStack_Documentation/Design_Documents/Coding_Conventions


Thanks,
-Nitin

-----Original Message-----
From: Deepti Dohare [mailto:deepti.dohare@citrix.com] 
Sent: Monday, June 04, 2012 4:31 PM
To: cloudstack-dev@incubator.apache.org
Cc: Deepti Dohare
Subject: [PATCH] CS-14345 Logout API is not returning XML header Description: The logout API
is not returning the standard XML header and the CloudStack version.


Signed-off-by: Deepti Dohare <deepti.dohare@citrix.com>
---
 server/src/com/cloud/api/ApiServlet.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java
index b7b7fff..ba4856e 100755
--- a/server/src/com/cloud/api/ApiServlet.java
+++ b/server/src/com/cloud/api/ApiServlet.java
@@ -29,6 +29,7 @@ import org.apache.log4j.Logger;  import com.cloud.cluster.StackMaid;  import
com.cloud.exception.CloudAuthenticationException;
 import com.cloud.server.ManagementServer;
+import com.cloud.server.ManagementService;
 import com.cloud.user.Account;
 import com.cloud.user.AccountService;
 import com.cloud.user.UserContext;
@@ -39,6 +40,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 public class ApiServlet extends HttpServlet {
     public static final Logger s_logger = Logger.getLogger(ApiServlet.class.getName());
     private static final Logger s_accessLogger = Logger.getLogger("apiserver." + ApiServer.class.getName());
+    public static ManagementService _mgr = (ManagementService) 
+ ComponentLocator.getComponent(ManagementService.Name);
 
     private ApiServer _apiServer = null;
     private AccountService _accountMgr = null; @@ -430,7 +432,10 @@ public class ApiServlet
extends HttpServlet {
         if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
             sb.append("{ \"logoutresponse\" : { \"description\" : \"success\" } }");
         } else {
-            sb.append("<logoutresponse><description>success</description></logoutresponse>");
+                sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
+                sb.append("<logoutresponse cloud-stack-version=\"" + _mgr.getVersion()
+ "\">");
+                sb.append("<description>success</description>");
+                sb.append("</logoutresponse>");
         }
         return sb.toString();
     }
--
1.7.4.1


Mime
View raw message