jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Re: service locators and class-level @Path

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 21 Feb 2012 09:11:15 -0500

On Feb 21, 2012, at 5:35 AM, Marek Potociar wrote:

> I'd say that according to the JSR311, section 3.7.2, step 2, the @Path annotation on the sub-resource class will be ignored.
>
> IOW, in your example,a GET to "/test/locator" will be matched, but a GET to "/test/locator/abc" will not be matched.

 I agree. There's a single root resource class matched by the algorithm, after that is just methods or locators. @Path would need to be on foo() to match "/test/locator/abc".

-- Santiago

> On 02/20/2012 08:34 PM, Bill Burke wrote:
>> i have a bug from a user that I"m not sure its a bug or not because the spec isn't clear:
>>
>> The spec allows a service locator that has no @Path annotation on the class:
>>
>> public class MyLocator {
>>
>> @GET
>> public String foo() {..}
>>
>>
>> Now, if this class has a @Path on it, is that @Path ignored or not when matching?
>>
>>
>> @Path("abc")
>> public class MyLocator {
>>
>> @GET
>> public String foo() {...}
>> }
>>
>>
>> @Path("/test")
>> public class MyService {
>>
>> @Path("/locator")
>> public MyLocator getLocator() {...}
>>
>> }
>>
>>
>> So, to get to call teh foo() method is the path "/test/locator/abc" or /test/locator"? Is the class level @Path ignored
>> or not?
>>
>>