dev@jersey.java.net

list operator in URI templates

From: Jim Webber <jim_at_webber.name>
Date: Fri, 5 Feb 2010 01:06:58 +0100

Hi folks,

I'm trying to use the list operator in a URI template. A simple example would be:

    @GET
    @Path("/foo/{-list|;|types}")
    public Response testMethod(@PathParam("types") String[] strings) {
        for(String str : strings) {
            System.out.println(str);
        }
        
        return Response.ok().build();
    }

At runtime, I get an exception pointing to the "-" in the list operator being problematic:

java.lang.IllegalArgumentException: Illegal character '-' at position 6 is not as the start of a name
        at com.sun.jersey.api.uri.UriTemplateParser.parseName(UriTemplateParser.java:306)

[snip]


Can anyone shed any light on this at all?

Thanks,

Jim