Hi Nirmal, But it works in get deployment policy endpoint, so it can not be a limitation ?
curl -X GET -H "Content-Type: application/json" -d @'app-php-only.json' -k -u admin:admin https://localhost:9443/stratos/admin/policy/deployment/economyDeploymentPolicy | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 908 0 353 100 555 5364 8434 --:--:-- --:--:-- --:--:-- 8538 { "deploymentPolicy": { "id": "economyDeploymentPolicy", "partitionGroup": [ { "id": "ec2", *"partition": [* * {* * "id": "AWSEC2AsiaPacificPartition1",* * "isPublic": false,* * "partitionMax": 3,* * "partitionMin": 1,* * "property": [* * {* * "name": "region",* * "value": "ap-southeast-1"* * },* * {* * "name": "zone",* * "value": "ap-southeast-1a"* * }* * ],* * "provider": "ec2"* * }* * ],* "partitionAlgo": "one-after-another" } ], "public": false } } On Wed, Nov 5, 2014 at 7:21 PM, Udara Liyanage <[email protected]> wrote: > Hi, > > When I add the name of the variable to the cxf-servlet.xml as > serializeAsArray, > now cartridges are shown as arrays. > <value>cartridges</value> > > But we can't specify it for each variable. > > > > > On Wed, Nov 5, 2014 at 6:35 PM, Udara Liyanage <[email protected]> wrote: > >> Hi, >> >> When I execute the GET serviceGroup Stratos endpoint I get the folowing >> output in two different groups. Please note cartridges text in bold. When >> there are only one cartridge, it shows as a String (output1), when there >> are multiple cartridges it is shown as an array (output2). >> >> But when I convert the object to a json text, it shows as arrays even >> when there are single cartridge. >> >> The issue happens when the object is sent in response as below >> >> return Response.ok().entity(serviceGroupDefinition).build(); >> >> >> In the code carridges is set as a list. >> >> >> 1. List<String> cartridgesDef = new ArrayList<String>(Arrays.asList( >> cartridges)); >> 2. servicegroupDef.setCartridges(cartridgesDef); >> >> >> [1] suggested to set serializeAsArray as true in cxf-servlet.xml.xml, I >> tried doing it too. But same result. >> >> What is the reason for this? >> >> >> output [1] >> >> { >> "serviceGroup": [ >> { >> * "cartridges": "tomcat",* >> "dependencies": { >> "startupOrders": "group.group1,cartridge.tomcat", >> "terminationBehaviour": "terminate-dependents" >> }, >> "name": "group5", >> "subGroups": "group1" >> } >> ] >> } >> >> output [2] >> >> { >> "serviceGroup": { >> "cartridges": *[* >> * "tomcat",* >> * "php"* >> * ],* >> "dependencies": { >> "startupOrders": "group.group1,cartridge.tomcat", >> "terminationBehaviour": "terminate-dependents" >> }, >> "name": "group6", >> "subGroups": "group2" >> } >> } >> >> [1] >> http://stackoverflow.com/questions/18918091/when-a-list-has-only-one-element-cxf-return-the-object-instead-a-js-array >> -- >> >> Udara Liyanage >> Software Engineer >> WSO2, Inc.: http://wso2.com >> lean. enterprise. middleware >> >> web: http://udaraliyanage.wordpress.com >> phone: +94 71 443 6897 >> > > > > -- > > Udara Liyanage > Software Engineer > WSO2, Inc.: http://wso2.com > lean. enterprise. middleware > > web: http://udaraliyanage.wordpress.com > phone: +94 71 443 6897 > -- Udara Liyanage Software Engineer WSO2, Inc.: http://wso2.com lean. enterprise. middleware web: http://udaraliyanage.wordpress.com phone: +94 71 443 6897
