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


Kynan Fraser wrote:
> 
> Done: https://issues.apache.org/jira/browse/CXF-2439
> 
> 
> Sergey Beryozkin wrote:
>> 
>> Hi Kynan
>> 
>> No, not yet. Please open the JIRA for it (make it 'Fix for 2.3')
>> 
>> thanks, Sergey
>> 
>> 
>> Kynan Fraser wrote:
>>> 
>>> Hi Sergey,
>>> 
>>> Was there a JIRA issue opened for this or has it been added as a
>>> feature?
>>> 
>>> Regards,
>>> Kynan
>>> 
>>> 
>>> Sergey Beryozkin-2 wrote:
>>>> 
>>>> Hi
>>>> 
>>>> It's just a JAXRS selection algorithm that dictates it, or rather, it
>>>> does not allow for selecting between multiple resource classes 
>>>> which have the same Path value. Perhaps you may want to consider using
>>>> Path values with custom regular expressions rather than 
>>>> hardcoding unique values into each root class's Path values.
>>>> I kind of like the idea of trying another resource class if the
>>>> initially taken route through the initially chosen root class 
>>>> produces no valid operation - I'll add it to the list...
>>>> 
>>>> Can you explain a bit more please about this issue :
>>>> 
>>>>>>> Not sure if it is related, but also ran into a similar problem,
>>>>>>> where when
>>>>>>> I have two service interfaces like below...where service A and B
>>>>>>> both have a
>>>>>>> common sub-path.  It seems that both /v3/authenticate and
>>>>>>> /v4/authenticate
>>>>>>> are available.  However, /v4/authenticate/validate is not available. 
>>>>>>> No
>>>>>>> sub-path for a method is available in v4 if v3 doesn't have the same
>>>>>>> path.
>>>>>>> If I remove the v3 bean, then both v4 methods are available.
>>>>>>>
>>>>>>> *Take the following from cxf_beans.xml where I define 2 service
>>>>>>> beans:*
>>>>>>>
>>>>>>>   <jaxrs:server id="serviceServer" address="/">
>>>>>>>     <jaxrs:serviceBeans>
>>>>>>>       <ref bean="contactServiceImpl3" />
>>>>>>>       <ref bean="contactServiceImpl4" />
>>>>>>>     </jaxrs:serviceBeans>
>>>>>>>
>>>>>>> *Here are the service interfaces:*
>>>>>>>
>>>>>>> =====
>>>>>>>
>>>>>>> @Path("/v3")
>>>>>>> public interface AuthenticationService {
>>>>>>>     @GET
>>>>>>>     @Path("/authenticate/{uid}:{pass}")
>>>>>>>     public Response authenticate(@PathParam("uid") String username,
>>>>>>> @PathParam("pass") String password);
>>>>>>> }
>>>>>>>
>>>>>>> =====
>>>>>>>
>>>>>>> @Path("/v4")
>>>>>>> public interface AuthenticationService {
>>>>>>>     @GET
>>>>>>>     @Path("/authenticate/{uid}:{pass}")
>>>>>>>     public Response authenticate(@PathParam("uid") String username,
>>>>>>> @PathParam("pass") String password);
>>>>>>>
>>>>>>>     @GET
>>>>>>>     @Path("/authenticate/validate/{token}")
>>>>>>>     public Response validate(@PathParam("token") String token);
>>>>>>> }
>>>>>>>
>>>>>>> =====
>>>> 
>>>> I'm presuming those 2 AuthenticationService(s) are in different
>>>> packages ?
>>>> 
>>>> So if you do "/v4/authenticate/validate/BTaaZUycRa" then no operation
>>>> can be found unless you remove a bean which implements
>>>> AuthenticationService with /v3 ?
>>>> 
>>>> 
>>>> cheers, Sergey
>>>> 
>>>> ----- Original Message ----- 
>>>> From: "David Castro" <[email protected]>
>>>> To: <[email protected]>
>>>> Sent: Thursday, April 16, 2009 1:59 AM
>>>> Subject: Re: JAXRS: Multiple service beans problem
>>>> 
>>>> 
>>>>> Have my own little conversation going here now ;)   So looking deeper
>>>>> at
>>>>> that other post, apparently you need to have a unique root path name
>>>>> for
>>>>> each service class for the matching to work right now.  Kind of a
>>>>> bummer
>>>>> that you can't have multiple classes with / for a root path and just
>>>>> have
>>>>> CXF search all / path classes for particular sub-resource locators.
>>>>> But at
>>>>> least I know how to get around the issue there.
>>>>>
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JAXRS%3A-Multiple-service-beans-problem-tp23069677p26217379.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to