You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2014/03/14 13:15:37 UTC

git commit: Refacor CLI code and remove root element from the constructed json

Repository: incubator-stratos
Updated Branches:
  refs/heads/master 30279d356 -> f32b3cfe9


Refacor CLI code and remove root element from the constructed json


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f32b3cfe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f32b3cfe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f32b3cfe

Branch: refs/heads/master
Commit: f32b3cfe93a0dcb0fb1bb4a052d96102cc9567b6
Parents: 30279d3
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Fri Mar 14 17:43:49 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Fri Mar 14 17:43:49 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/RestCommandLineService.java | 9 +++------
 .../src/main/webapp/stratos/WEB-INF/cxf-servlet.xml         | 5 +----
 2 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f32b3cfe/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 6f73e9d..52e2a97 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -742,7 +742,6 @@ public class RestCommandLineService {
         Gson gson = gsonBuilder.create();
 
         String jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
-        String completeJsonSubscribeString = "{\"cartridgeInfoBean\":" + jsonSubscribeString + "}";
 
         SubscriptionInfo subcriptionConnectInfo = null;
         if (StringUtils.isNotBlank(dataCartridgeType) && StringUtils.isNotBlank(dataCartridgeAlias)) {
@@ -750,7 +749,7 @@ public class RestCommandLineService {
                     dataCartridgeAlias);
             try {
                 HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + subscribCartridgeRestEndpoint,
-                        completeJsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
+                        jsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
 
                 String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -803,10 +802,9 @@ public class RestCommandLineService {
             cartridgeInfoBean.setPersistanceRequired(persistanceMapping);
 
             jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
-            completeJsonSubscribeString = "{\"cartridgeInfoBean\":" + jsonSubscribeString + "}";
 
             HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + subscribCartridgeRestEndpoint,
-                    completeJsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
+                    jsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -878,10 +876,9 @@ public class RestCommandLineService {
             Gson gson = gsonBuilder.create();
 
             String jsonString = gson.toJson(tenantInfo, TenantInfoBean.class);
-            String completeJsonString = "{\"tenantInfoBean\":" + jsonString + "}";
 
             HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + addTenantEndPoint,
-                    completeJsonString, restClientService.getUsername(), restClientService.getPassword());
+                    jsonString, restClientService.getUsername(), restClientService.getPassword());
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f32b3cfe/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
index f15be4f..fbb8b10 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
@@ -31,10 +31,6 @@
         </jaxrs:serviceBeans>
 
         <jaxrs:providers>
-            <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
-                <property name="dropRootElement" value="true"/>
-                <property name="supportUnwrapped" value="true"/>
-            </bean>>
             <ref bean="jsonProvider"/>
             <ref bean="exceptionHandler"/>
             <ref bean="basicAuthenticationFilter"/>
@@ -57,6 +53,7 @@
         <property name="oauthValidationEndpoint" value="https://localhost:9443/services/"/>
     </bean>
     <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
+        <property name="supportUnwrapped" value="true"/>
         <property name="serializeAsArray" value="true"/>
         <property name="arrayKeys">
             <list>