cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [19/28] git commit: updated refs/heads/auth-refactor to 03ad002
Date Tue, 12 Aug 2014 08:55:49 GMT
ApiServlet: move setting of response type up in the layer

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/828be48c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/828be48c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/828be48c

Branch: refs/heads/auth-refactor
Commit: 828be48ca81008d70c22bf14495cf0582cb5a3de
Parents: 2c99f20
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Aug 12 09:14:50 2014 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Aug 12 09:19:44 2014 +0200

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServlet.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/828be48c/server/src/com/cloud/api/ApiServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java
index 5a8cf94..d94894a 100644
--- a/server/src/com/cloud/api/ApiServlet.java
+++ b/server/src/com/cloud/api/ApiServlet.java
@@ -143,6 +143,12 @@ public class ApiServlet extends HttpServlet {
         }
 
         try {
+            if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+                resp.setContentType(ApiServer.getJsonContentType() + "; charset=UTF-8");
+            } else {
+                resp.setContentType("text/xml; charset=UTF-8");
+            }
+
             HttpSession session = req.getSession(false);
             final Object[] responseTypeParam = params.get(ApiConstants.RESPONSE);
             if (responseTypeParam != null) {
@@ -301,12 +307,6 @@ public class ApiServlet extends HttpServlet {
     // FIXME: rather than isError, we might was to pass in the status code to give more flexibility
     private void writeResponse(final HttpServletResponse resp, final String response, final
int responseCode, final String responseType) {
         try {
-            if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
-                resp.setContentType(ApiServer.getJsonContentType() + "; charset=UTF-8");
-            } else {
-                resp.setContentType("text/xml; charset=UTF-8");
-            }
-
             resp.setStatus(responseCode);
             resp.getWriter().print(response);
         } catch (final IOException ioex) {


Mime
View raw message