Regarding your reply to #2 and #4, you may wish to look at:
JAX-RS JavaDoc - javax.ws.rs Annotation Type Path
In the 'Element Detail' section of the page it reads:
====================
Defines a URI template for the resource class or method, must not
include matrix parameters.
Embedded template parameters are allowed and are of the form:
param = "{" *WSP name *WSP [ ":" *WSP regex *WSP ] "}"
name = (ALPHA / DIGIT / "_")*(ALPHA / DIGIT / "." / "_" / "-" ) ;
\w[\w\.-]*
regex = *( nonbrace / "{" *nonbrace "}" ) ; where nonbrace is any char
other than "{" and "}"
See RFC 5234 for a description of the syntax used above and the
expansions of WSP, ALPHA and DIGIT. In the above name is the template
parameter name and the optional regex specifies the contents of the
capturing group for the parameter.
====================
Note that the URI template 'must not include the matrix parameters'. As
a result, matrix parameters are not bound to a URI path segment. It
also means that #4 should match, since you cannot explicitly call out
the presence or absence of a matrix parameter using the URI template.
This is in fact a known issue, that I would assume is attributable to
this statement. Ideally, I would like to call out what matrix parameter
is valid on what path. In most cases, this is what is needed.
I've actually tried to put some regular expressions in place to attempt
this, but have been striking out badly.
Regards, Bruce
-----Original Message-----
From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2008 12:54 PM
To: [email protected]
Subject: Re: @MatrixParam anomoly - four test cases w/ code example
Hi
Thanks for posting your test results
//Test #2 - Seems like the ';matrixParam=ParamValue' should not appear
in 'tail:'
//Full Request URI: //CXF22/base/beginTail;matrixParam=ParamValue
S.B. I need to confirm it on the jaxrs user list - technically
MatrixParam is part of a single path segment
//Test #3 - Seems like ';matrixParam=ParamValue' should not appear in
'base', and should appear in 'matrixParm'
//Full Request URI: //CXF22/base;matrixParam=ParamValue/beginTail
S.B. Need to check this one too, as I'm not sure if all the matching
path segments but the last one need to be checked
//Test #4 - change the @Path to be @Path("base/{tail}, then append
';matrixParam=ParamValue' to it.
// The following URL then does not match
".../base;matrixParam=ParamValue/beginTail"
S.B I think it might be correct as there're is only 'base' in the 'base'
path segment @Path("base/{tail}
I'll confirm it all and get back to you
Cheers, Sergey
----- Original Message -----
From: "Maxfield, Bruce D. (LNG-DAY)" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, November 21, 2008 5:11 PM
Subject: @MatrixParam anomoly - four test cases w/ code example
I've been working with the CXF 2.2 snapshot and have encountered what I
believe to be anomalies in its behavior. Below is my test code, then
below that the output/description of four test cases. Any insight into
whether this is expected behavior or a defect would be appreciated.
package com.example.simpleJaxRsResources;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
@Path("{base}/{tail}")
@Produces("text/plain")
public class FirstResource {
@GET
public String getFirstResource(@PathParam("base") String base,
@PathParam("tail") String tail,
@MatrixParam("matrixParam") String matrixParm,
@Context UriInfo info) {
return "Full Request URI: " + info.getRequestUri() + "\n" +
"base: " + base + "\n" +
"tail: " + tail + "\n" +
"matrixParm=" + matrixParm;
}
}
//Test #1
//Full Request URI: //CXF22/base/beginTail
//base: base
//tail: beginTail
//matrixParm=null
//Test #2 - Seems like the ';matrixParam=ParamValue' should not appear
in 'tail:'
//Full Request URI: //CXF22/base/beginTail;matrixParam=ParamValue
//base: base
//tail: beginTail;matrixParam=ParamValue
//matrixParm=ParamValue
//Test #3 - Seems like ';matrixParam=ParamValue' should not appear in
'base', and should appear in 'matrixParm'
//Full Request URI: //CXF22/base;matrixParam=ParamValue/beginTail
//base: base;matrixParam=ParamValue
//tail: beginTail
//matrixParm=null
//Test #4 - change the @Path to be @Path("base/{tail}, then append
';matrixParam=ParamValue' to it.
// The following URL then does not match
".../base;matrixParam=ParamValue/beginTail"