dev@jsr311.java.net

Re: JSR311: Resolving duplicate _at_MatrixParam

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 19 Feb 2008 11:05:53 -0500

On Feb 18, 2008, at 2:05 PM, Bill Burke wrote:

> I know we discussed this before. What if a the same matrix param
> name exists within different path segments? What if we allowed the
> combination of @PathParam and @MatrixParam?
>
> @Path("/{foo}/{bar}")
> @GET String get(@PathParam("foo") @MatrixParam("name") String
> fooName, @PathParam("bar") @MatrixParam("name") String barName) {...}
>
> If this has already been suggested, I apologize.
>
I don't recall this being suggested before. I don't like the
overloading of @PathParam, if we were to support this kind of scoping
for @MatrixParam then I'd prefer an additional property on that
annotation, e.g.:

@Path("/{foo}/{bar}")
@GET String get(@MatrixParam(value="name", scope="foo") String
fooName, @MatrixParam(value="name", scope="bar") String barName) {...}

However, I wonder if we really need this kind of scoping. The server
gets to decide what the matrix param names are and which path segments
they can be attached to. If clashing is a problem then why wouldn't
you just rename one of the params ?

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.