You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mingchen xiao <vi...@gmail.com> on 2013/03/07 08:44:38 UTC

ask for help about cxf issue

hi dear;
 I want to publish more than one service in an interface.

 this is the configuration file

 <jaxrs:server address="/productSignResults" >
<jaxrs:serviceBeans>
<ref bean="productSignResultsServices" />
<ref bean="productRiskSurveyResultsServices" />
<ref bean="protocolSignResultsService" />
</jaxrs:serviceBeans>
<jaxrs:extensionMappings>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</jaxrs:extensionMappings>
<!--log intercepters -->
<jaxrs:inInterceptors>
<ref bean="inInter" />
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="outInter" />
</jaxrs:outInterceptors>
 </jaxrs:server>

then , i only cat access methods of the first bean
“productSignResultsServices” 。
cant't access method in "productRiskSurveyResultsServices" and
"protocolSignResultsService" 。

Re: ask for help about cxf issue

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 07/03/13 07:44, mingchen xiao wrote:
> hi dear;
>   I want to publish more than one service in an interface.
> 
>   this is the configuration file
> 
>   <jaxrs:server address="/productSignResults">
> <jaxrs:serviceBeans>
> <ref bean="productSignResultsServices" />
> <ref bean="productRiskSurveyResultsServices" />
> <ref bean="protocolSignResultsService" />
> </jaxrs:serviceBeans>
> <jaxrs:extensionMappings>
> <entry key="json" value="application/json" />
> <entry key="xml" value="application/xml" />
> </jaxrs:extensionMappings>
> <!--log intercepters -->
> <jaxrs:inInterceptors>
> <ref bean="inInter" />
> </jaxrs:inInterceptors>
> <jaxrs:outInterceptors>
> <ref bean="outInter" />
> </jaxrs:outInterceptors>
>   </jaxrs:server>
> 
> then , i only cat access methods of the first bean
> “productSignResultsServices” 。
> cant't access method in "productRiskSurveyResultsServices" and
> "protocolSignResultsService" 。
> 

I think this is because all 3 root resources have a common @Path value
such as "/" ?
In CXF 2.8.0 it will just work, in earlier CXFs, you can either register
CXF ResourceComparator:
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresources

or try to update resources such that there's no ambiguity in the
mappings, example, instead of

@Path("/")
public class Root1 {
   @Path("/")
   @GET get() {}
}

@Path("/")
public class Root2 {
   @Path("/a")
   @GET get() {}
}

update Root2 as follows:

@Path("/a")
public class Root2 {
   @Path("/")
   @GET get() {}
}
etc

HTH, Sergey