users@jersey.java.net

Re: [Jersey] SubResource Path patterns

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 08 Dec 2008 10:07:44 -0500

On Dec 6, 2008, at 4:07 PM, saturon wrote:
> Just ran into the following exception. Can someone tell help me
> there is something wrong with this syntax? I am using Jersey 0.8 in
> Glassfish v2
>
>
Each path parameter is specified singly, e.g. @Path("{mediaId},
{entityId}") assuming ',' is the separator in the path segment. Note
that @Path("{mediaId}{entityId}") is unlikely to work since the JAX-RS
runtime won't know where {mediaId} ends and {entityId} starts - for
that you need to use the extended syntax and supply your own regex and
to do that you'll need to upgrade to 1.0. See:

https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/
Path.html#value()

Marc.
> com.sun.enterprise.deployment.backend.IASDeploymentException:
> ContainerBase.addChild: start: LifecycleException:
> java.util.regex.PatternSyntaxException: Illegal repetition near
> index 0
>
> /{mediaId,entityId}/
>
>
> @Path("{mediaId,entityId}/")
> public ImageResource getImageResource(@PathParam("mediaId") Long
> mediaId, @PathParam("entityId") Long entityId) {
> return new ImageResource(mediaId,entityId,request,
> httpHeaders);
> }
>
>
> Thanks Ben
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.