Hi Geoffrey,
Unfortunately only the matrix parameters that are at the end of the
URI path can be bound to @MatrixParam.
The case of the end "/" looks like a bug. What version of Jersey are
you using?
All matrix parameters are available from the UriInfo.getPathSegments:
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/UriInfo.html
#getPathSegments%28%29
If you want to get access to the map of matrix parameters you can
identify the path segment as parameter:
@Path("{id: X}") // Use a regex that maps the literal character 'X'
public class X {
public X(@PathParam("id") PathSegment ps) {
MultivaluedMap<String, String> mps = ps.getMatrixParameters();
...
}
}
I think what we are missing from JAX-RS is the following:
1) The ability to get the current path segment or segments associated
with the resource; and
2) a qualifier on @MatrixParam to declare that the matrix parameter is
associated with the current path segment
(or the last path segment in the current set).
Could you log a feature?
Paul.
On Nov 2, 2009, at 3:09 AM, geoffrey hendrey wrote:
> Hi,
>
> I've got a resource class, call it X, on an arbitrary path.
>
> .../X
>
> If I pass a URL matrix parameter to Resource X as follows, the
> matrix parameter is properly injected into class X
> .../X;a=hello
>
> However, if I add so much as a trailing slash to the path, then I
> don't receive the injected matrix parameter. E.g., this doesn't work:
>
> .../X;a=hello/
>
> and this doesn't work either
>
> .../X;a=hello/b/c/d
>
> Everything I have read indicates that I should be able to receive
> parameter "a". Any ideas on what might cause this to fail?
>
> -geoff
>
> --
> http:nextdb.net - RESTful Relational Database
> http://www.nextdb.net/wiki/en/REST