On Thu, Apr 16, 2009 at 2:40 AM, Sergey Beryozkin <[email protected]>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...
>
Regexes...didn't know that was possible! That's good to know, thanks.
>
> 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 ?
>
Yes, two separate interfaces. They just happen to share common sub-locator
paths.
>
> So if you do "/v4/authenticate/validate/BTaaZUycRa" then no operation can
> be found unless you remove a bean which implements
> AuthenticationService with /v3 ?
>
Correct. The validate is hidden until the the v3 bean is removed. But
authenticate method works fine on both, presumable because it exists in
both.
>
>
> 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.
>>
>>
>