users@jersey.java.net

Re: [Jersey] letting /resource/ and /resource be the same

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 18 Aug 2009 16:10:47 +0200

On Aug 18, 2009, at 3:38 PM, tarjei wrote:

> Hi,
>
> I'm using 1.1.0-ea. I tried upgrading to 1.1.1-ea as well with the
> same result.
>
> On 08/18/2009 03:16 PM, Paul Sandoz wrote:
>> Hi,
>>
>> What is the value of the @Path ?
>
> The setup is:
>
> @Path("/")
> //_at_ProduceMime("application/xml")
> @Component("root")
> class Root {
> ...
> }
>
> @Path("Filter")
> @Produces("application/xml")
> @Service("jersey.filterFrontend")
> class Resource {
> @GET
> public List<Filter> list() {}
> }
>
> I've tried adding @Path("/") and @Path("") to the list() method, but
> without success.
>
> Changing the class @Path from @Path("Filter") to @Path("Filter/")
> worked.
>
> I guess that is what confused me. I thought that if I had @Path("/")
> then that would be appended to the base path.

No, @Path("") and @Path("/") on sub-resources are really edge cases
that we should not support for sub-resource locators and for sub-
resource methods we should ignore (i.e. it is like the @Path not being
there).

"/" always causes edge case trouble :-)


> At least the issue is resolved.
>

Great.

Paul.