Hi Bruce
Can you give me a favour and clarify on one of the path expressions.
<snip/>
@Path("{base:base.+suffix}/{tail}")
<mailto://@Path(%22%7bbase:base.+suffix%7d/%7btail%7d%22)>
can you give me a favor and resend this @Path value, possibly in quotes,
should it read :
"@Path(%22%7bbase:base.+suffix%7d/%7btail%7d%22)" ?
or can be be that a mail reader has encoded the
@Path("{base:base.+suffix}/{tail}") ?
Thanks, Sergey
----- Original Message -----
From: "Maxfield, Bruce D. (LNG-DAY)" <[EMAIL PROTECTED]>
To: <users@cxf.apache.org>
Sent: Tuesday, November 25, 2008 3:39 PM
Subject: Support for Regular Expressions in @Path Annotation using CXF JAX-RS
It appears that the regular expression matching within CXF JAX-RS is not
working properly. I've used a recent (probably 11/20) 2.2 Trunk Release
of CXF to perform these tests along side Jersey 1.0. Below is the test
case code followed by a series of side-by-side test cases using CXF and
Jersey:
-------------------------------------------------
--------- RESOURCE CODE ------------
-------------------------------------------------
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:base.+}/{tail}") - Failed to parse
//@Path("base/{tail}")
//@Path("{base}/{tail}")
//@Path("{base}/{tail}")
//@Path("{base:base.+}/{tail}")
//@Path("{base:.+base}/{tail}")
@Path("{base:base.+suffix}/{tail}")
<mailto://@Path(%22%7bbase:base.+suffix%7d/%7btail%7d%22)>
@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 CASE RESULTS --------
----------------------------------------------
- USE OF REGEX IN @Path TEST RESULTS -
Using Ecplise 3.2, Apache Tomcat 5.5, Jersey 1.0 and CXF latest build.
=======================================
Test #1 - @Path("{base:base.+}/{tail}")
=======================================
---- JERSEY ----
Full Request URI: http://localhost:8088/Jersey_10/base_suffix/tail
base: base_suffix
tail: tail
matrixParm=null
---- CXF ----
Triggered an exception during Tomcat application start-up with the
following text in the Eclipse console:
Error creating bean with name 'RestCXF_01': Error setting property
values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is
java.util.regex.PatternSyntaxException: Illegal repetition near index 0
/{base:base.+}/([^/]+?)(/.*)?
=======================================
Test #2 - @Path("{base:.+base}/{tail}")
=======================================
---- JERSEY ----
Full Request URI: http://localhost:8089/Jersey_10/prefixbase/tail
base: prefixbase
tail: tail
matrixParm=null
---- CXF ----
Triggered an exception during Tomcat application start-up with the
following text in the Eclipse console:
Error setting property values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is
java.util.regex.PatternSyntaxException: Illegal repetition near index 0
/{base:.+base}/([^/]+?)(/.*)?
=============================================
Test #2 - @Path("{base:base.+suffix}/{tail}")
=============================================
---- JERSEY ----
Full Request URI: http://localhost:8089/Jersey_10/base_core_suffix/tail
base: base_core_suffix
tail: tail
matrixParm=null
---- CXF ----
Triggered an exception during Tomcat application start-up with the
following text in the Eclipse console:
Error creating bean with name 'RestCXF_01': Error setting property
values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is
java.util.regex.PatternSyntaxException: Illegal repetition near index 0
/{base:base.+suffix}/([^/]+?)(/.*)?