On 12/06/13 15:15, Tarun Kumar wrote:
I have mutiple serviceBeans in cxf:rsServer component.

<cxf:rsServer id="rsServer" address="
http://localhost:8080/services/employees>
<cxf:serviceBeans>
   <ref bean="aBean" />
   <ref bean="bBean" />
</cxf:serviceBeans>
</cxf:rsServer>

<bean id="aBean" class="x.y.ClassA" />
<bean id="bBean" class="x.y.ClassB" />

Here ClassA and ClassB are implementation of service interfaces.

I have one route class for each service route.
for first service:

from("cxfrs://bean://rsServer?resourceClass=ClassA.getClass().getName()).to().end();

for second one"

from("cxfrs://bean://rsServer?resourceClass=ClassB.getClass().getName()).to().end();
I'm not sure you have to list the class names, the JAX-RS runtime will itself figure out which service bean is to be invoked, you can probably collapse multiple routes into a single one


When i hit second service and put debugger in both routes (route of first
service and second service), route of first service is being hit. Why is
that? How can i make sure that only corresponding route gets hit?

This is likely to be more of the JAX-RS issue. At the moment, if you have multiple root resources with the same @Path value then the 1st matching root resource will get selected and if it has no matching operation then no back-tracking is done. What you can do is try and make sure each root resource covers its own unique URI space, or try using a CXF extension:
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresources

it actually lists a working implementation Jan Bernhardt needed for his project

Note, in CXF 3.0 selecting between root resources with exactly the same path will work as per JAX-RS 2.0 rules

Sergey
--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to