users@jersey.java.net

Re: [Jersey] Inheritance of duplicate _at_MatrixParam

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 19 Jan 2009 13:23:06 +0100

HI Gili,

You are correct, matrix parameters using @MatrixParam are currently
merged. We cannot change the spec for the maintenance release, but i
suggest you log an issue against JAX-RS so we can track it. Note that
an @Path can have multiple path segments associated with it so the
problem can arise even when sub-resource locators are not utilized.
What you seem to be suggesting is that @MatrixParam should only apply
to the parameters of the last path segment that has been currently
matched?

The only way to currently get matrix parameters for a path segment is
from the List<PathSegment>.

One way to do this is to obtain the path segment as a path parameter.

   @PathParam("{id}") PathSegment seg

then get the map of matrix parameters from seg. You can turn a literal
path segment into a path parameter, @Path("{image}: image") if
necessary.

Paul.

On Jan 18, 2009, at 5:24 PM, Gili wrote:

>
> Hi,
>
> Given:
>
> /images;offset={offset};count={count}/random;count={count}
>
> where "images" is one resource and "random" is a sub-resource. It is
> my
> understanding that if a client does not provide the second "count"
> when I
> query for its value I will get back the value of the first "count".
> Furthermore, it is my understanding that there is no way for me to
> detect
> whether the second count is really empty or not. I personally think
> this
> behavior is wrong, even if it's "working as designed". Is it
> possible to
> change the specification on this front such that @MatrixParam is *not*
> inherited? If I really want the parent @MatrixParam value I would
> pass it
> forward to the sub-resource constructor...
>
> Ideas?
>
> Gili
> --
> View this message in context: http://n2.nabble.com/Inheritance-of-duplicate-%40MatrixParam-tp2177494p2177494.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
>