Hi reka, will switching to some other json provider like Jackson solves the issue... ? I prefer config files to be simple.. :) However will there be any other side effects..
--pradeep On Tue, Jan 28, 2014 at 12:39 PM, Reka Thirunavukkarasu <[email protected]>wrote: > Hi all, > > I was able to fix the issue by referring the suggestion as [1]. In our > Restendpoint webapp, i'm using the jsonProvider as following: > > <bean id="jsonProvider" > class="org.apache.cxf.jaxrs.provider.json.JSONProvider"> > <property name="serializeAsArray" value="true"/> > <property name="arrayKeys"> > <list> > <value>partitions</value> > <value>property</value> > <value>hostNames</value> > <value>memberMap</value> > <value>portMap</value> > <value>partitionGroup</value> > <value>partition</value> > </list> > </property> > </bean> > > The limitation here is that, we have to list down all the individual array > from all the bean classes where we use list or array. > Do you think that it is better to move to another better json provider? > > [1]. > http://mail-archives.apache.org/mod_mbox/cxf-users/201212.mbox/%3CCACYSh=YS35_aQRjPawhaPG1yjJ9bJhnBFdz5xqur3hS=etv...@mail.gmail.com%3E > > Thanks, > Reka > > > On Mon, Jan 27, 2014 at 4:45 PM, Reka Thirunavukkarasu <[email protected]>wrote: > >> Hi >> >> While i worked on the cli issue [1], found that json which received from >> the Rest endpoint is not backward compatible with the object again. Eg: >> Rest call is: >> >> >> @GET >> @Path("/partition") >> @Produces("application/json") >> @Consumes("application/json") >> @AuthorizationAction("/permission/protected/manage/monitor/tenants") >> public Partition[] getPartitions () throws RestAPIException { >> >> return ServiceUtils.getAvailablePartitions(); >> } >> >> The Partition Pojo is: >> >> @XmlRootElement >> public class Partition { >> >> public String id; >> >> public int partitionMin; >> >> public int partitionMax; >> >> public String provider; >> >> public List<PropertyBean> property; >> } >> >> This should result as: >> >> >> {"partition":[{"id":"P2","partitionMin":0,"partitionMax":0,"provider":"ec2","property": >> *[*{"name":"region","value":"ap-southeast-1"}*]*}]} >> >> but the actual response is when getPartitions from SM without the array >> type for the property: >> >> >> {"partition":[{"id":"P2","partitionMin":0,"partitionMax":0,"provider":"ec2","property":{"name":"region","value":"ap-southeast-1"}}]} >> >> So that the parser failed in cli to parse this string into Object. When i >> tested it with more than one property, it takes the property as an array. >> >> Did anyone observer such behavior? How can we handle this? >> >> [1]. https://issues.apache.org/jira/browse/STRATOS-383 >> >> Thanks, >> Reka >> >> -- >> Reka Thirunavukkarasu >> Software Engineer, >> WSO2, Inc.:http://wso2.com, >> Mobile: +94776442007 >> >> >> > > > -- > Reka Thirunavukkarasu > Software Engineer, > WSO2, Inc.:http://wso2.com, > Mobile: +94776442007 > > > -- Pradeep Fernando. http://pradeepfernando.blogspot.com/
