users@jersey.java.net

Re: [Jersey] Matching on param types

From: Martin Matula <Martin.Matula_at_Sun.COM>
Date: Tue, 14 Sep 2010 05:37:49 -0700

Hi,
You can't have exactly the same template on multiple GET methods. It
will report an error during the application deployment:

However, you do the following:

> @GET
> @Path("/process/{id: [0-9]+}")
> void process(@PathParam("id")long id);
>
> @GET
> @Path("/process/{id}")
> void process(@PathParam("id")String id);

In this case, the more specific template gets picked up - i.e. the
first one if it matches, otherwise the second one.
Martin

On Sep 14, 2010, at 5:13 AM, amsmota wrote:

>
> Hi all, I have another question. Does Jersey (or JAX-RS) consider the
> parameter types when matching URLs?
>
> For instance
> @GET
> @Path("/process/{id}")
> void process(@PathParam("id")long id);
>
> @GET
> @Path("/process/{id}")
> void process(@PathParam("id")String id);
>
> does /process/123 matches the first method and /process/aaa the
> second one?
>
> Cheers.
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Matching-on-param-types-tp5530004p5530004.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>