您的位置:首页 > 其它

cxf 相关问题

2013-06-28 09:54 239 查看
cxf不能将String的参数序列化的问题解决

问题:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> 
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

<util:list id="jsonKeys">
<value>app</value>
<value>comment</value>
</util:list>

<util:list id="jsonTypes">
<value>application/json</value>
<value>application/jettison</value>
</util:list>

<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<!--
<property name="dropRootElement" value="true" /> <property
name="dropCollectionWrapperElement" value="true" /> <property
name="supportUnwrapped" value="true" /> <property
name="serializeAsArray" value="true" /> <property
name="attributesToElements" value="true"/>
-->
<property name="serializeAsArray" value="true" />
<property name="arrayKeys" ref="jsonKeys" />
<property name="produceMediaTypes" ref="jsonTypes" />
<property name="consumeMediaTypes" ref="jsonTypes" />
<property name="ignoreNamespaces" value="true" />
<property name="dropRootElement" value="true" />
<property name="dropCollectionWrapperElement" value="true" />
<property name="ignoreMixedContent" value="true" />
<property name="supportUnwrapped" value="true" />
<property name="attributesToElements" value="true" />
</bean>


View Code

REFERENCES:http://hdxiong.iteye.com/blog/1752036

http://stackoverflow.com/questions/10895982/apache-cxf-generates-number-instead-of-string

http://yufenfei.iteye.com/blog/1717098
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: