users@jersey.java.net

Re: [Jersey] default method?

From: Craig McClanahan <craigmcc_at_gmail.com>
Date: Sat, 31 Oct 2009 22:33:23 -0700

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.

Craig McClanahan