cxf rest jsonp
在配置rest bean时。如下
<jaxrs:server id="LoginService" address="/login">
<jaxrs:serviceBeans>
<ref bean="LoginServiceImpl" />
</jaxrs:serviceBeans>
<!--
<jaxrs:extensionMappings>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
<entry key="jsonp" value="application/javascript" />
</jaxrs:extensionMappings> -->
<!-- jsonp输出拦截器 配置了callback 拦截属性 属性-->
<jaxrs:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
<bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpInInterceptor">
<property name="callbackParam" value="callback" />
</bean>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
<bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPreStreamInterceptor">
<property name="mediaType" value="application/javascript" />
</bean>
<bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPostStreamInterceptor">
<!-- default is ');' -->
<property name="paddingEnd" value=")" />
</bean>
</jaxrs:outInterceptors>
重写类
<!-- 重写json输出-->
<jaxrs:providers>
<bean class="com.kyeljmd.springcxf.common.utils.JsonpProvider"/>
</jaxrs:providers>