users@jersey.java.net

Re: [Jersey] uri matching question

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 03 Dec 2008 17:15:48 +0100

Hi,

This issue is now fixed in the trunk.

Paul.

On Nov 23, 2008, at 7:35 PM, Darrin Holst wrote:

> Hello All,
>
> I have 2 resources:
>
> @Path("{domain}/x_report")
>
> @Path("{domain}/{report_type}/{id}.{format}")
>
> The first resource will create the "x" report and save it to disk.
> The second resource just serves the file back so it is able to
> handle any report type.
>
> So given http://localhost/context/domain/x_report the first resource
> is called and the file is generated. Now I want to get the file at http://localhost/context/domain/x_report/123456.txt
> , but the problem is I'm getting a 404 when I try. I would expect it
> to be mapped to the second resource, but it never gets there. If I
> remove the first Path annotation temporarily then the second
> resource request works. I've found some threads explaining the match
> process with regards to the number of literal characters and number
> of parameters, but http://localhost/context/domain/x_report/
> 123456.txt shouldn't match the first resource, right?
>
> I was able to hack around the problem by changing the first resource
> to @Path("{domain}/{x: x_report}") so now they both have no literal
> characters and the second takes precedence because it has more
> parameters.
>
> Should this work like I think it should or am I missing something?
>
> Thanks,
> Darrin