cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <sbery...@progress.com>
Subject Re: JAXRS: Multiple service beans problem
Date Fri, 20 Nov 2009 12:02:54 GMT
Hi,

>
> I have run into the same issue, coupled with the fact that this is my 2nd day
> of trying to use cxf.
> can you provide any sort of example as to how this would be used?
> (I ran into the same problem - wanting to provide multiple service
> implementations within a single url pattern. Something like "/service/test1"
> and "/service/test2".

I've added some dcoumentation here :
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Customselectionbetweenmultipleresources

Note it is only supported in 2.2.5. Please register a custom resourceComparator impl.
>From the ClassResourceInfo you can get the name of the actual class using a getServiceClass()
method. Given the service class names 
and the current request URI you can choose if you'd like to impose some custom ordering or
not, 0 - if not.
I haven't had time to do a better documentation on this feature yet - but it should be quite
straightforward to start using it. Ot 
does requirte some knowledge of the internal api, but to the minimum (ClassResourceInfo.getServiceClass
plus new 
UriInfoImpl(message).getPath() and that is probably it).

cheers, Sergey



> Whichever one is listed first in the jaxrs:server is the one that matches.
> Creating multiple jaxrs:server elements didn't help (at least the way i did
> it.)
>
>
> Sergey Beryozkin wrote:
>>
>> Hi,
>>
>> See
>>
>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceComparator.java
>>
>> it can be registered as jaxrs:server/jaxrs:resourceComparator
>>
>> The custom implementation will be given a chance to select between
>> multiple matching class resources or resource methods
>>
>> thanks, Sergey
>>


Mime
View raw message