users@jersey.java.net

Re: [Jersey] default method?

From: Zoltan Arnold NAGY <Zoltan.Nagy_at_Sun.COM>
Date: Sun, 01 Nov 2009 10:01:46 +0100

Craig McClanahan wrote:
> On Sat, Oct 31, 2009 at 7:19 PM, Moises Lejter <moilejter_at_gmail.com> wrote:
>
>> But a method w/out a @GET is legal, as a way to switch to a sub-resource,
>> right?
>> I guess it might be better if the method was not called at all - but I am
>> guessing that the runtime did not realize that the return value was not in
>> fact a sub-resource until an instance was actually returned?
>>
>> Moises
>>
>>
>
> Per the JAX-RS specification, section 3.4.1, any resource method that
> has a @Path but no HTTP verb *must* return a sub-resource method. If
> your application fails to conform to that requirement (i.e. the class
> you return isn't annotated with @Path), it's a developer error.
>
> This cannot be detected at compile time or application initialization
> time, because the server cannot determine a priori whether the method
> will return a sub-resource instance or not. Therefore, it's a
> runtime-detected error.
>
>
Ah, didn't know that as I have never used this part.
Thanks for the explanation!

Zoltan