users@jsr311.java.net

Dealing with Matrix parameters

From: Sergey Beryozkin <sergey.beryozkin_at_progress.com>
Date: Mon, 24 Nov 2008 11:57:09 -0000

Hi,

A CXF user has posted some test results to a CXF user list with the conclusion that CXF JAXRS does not deal properly with matrix parameters which is something I'll be happy to fix but I'd like to verify few things first.

The method :

@GET
@Path("{base}/{tail}")
public String getFirstResource(@PathParam("base") String base,
                                               @PathParam("tail") String tail,
                                               @MatrixParam("matrixParam") String matrixParm) {}


1. GET /base/beginTail;matrixParam=ParamValue

The value for (@PathParam("tail") String) tail is "beginTail;matrixParam=ParamValue", but a user expectes only
"beginTail".

I still reckon it's correct. Instead a user could've used PathSegment as a 'tail' type in which case PathSegment.getPath() would return just 'beginTail'.
Is it correct ?

2. GET /base;matrixParam=ParamValue/beginTail

The value of (@MatrixParam("matrixParam") String) matrixParam is null which is most likely a CXF mistake I believe but I'd like to confirm : should all path segments (like {base} and {tail}) be checked for sa given matrix parameter or only the last parameterized segment ? For ex

@Path("{base}/{tail}") - only {tail} one is checked
@Path("base/{tail}") - only {tail} one is checked
@Path("{base}/tail") - only {base} one is checked
?

3. The above method gets changed like this :

@GET
@Path("base/{tail}")
public String getFirstResource(@PathParam("tail") String tail,
                                               @MatrixParam("matrixParam") String matrixParm) {}


as a result

GET /base;matrixParam=ParamValue/beginTail

does not match the method.

I think it's correct, 'base' is not capturing anymore and hence an exact match is required


I'd appreciate if someone could please confirm on what is said above makes sense//prove me wrong...

Many thanks, Sergey