users@jersey.java.net

How to capture a possibly variable number of PathParams ?

From: Gavin Bong <malaisien_at_gmail.com>
Date: Fri, 22 Jan 2010 12:13:34 +0800

Hello,

I am currently using Jersey 1.1.4

I have a Resource that roughly looks like the following:

@Path( "/sys/{language}" )
public class SystemResource
{
    @GET @Path( "rest" )
    public Response doGet( @PathParam( "rest" ) String rest )
    {
       .... snipped ...
    }
}

What I've found are:
a) Each placeholder for a PathParam is a mandatory field in the URL
b) Each PathParam cannot accept an encoded string e.g. "holy%2Fcow"

What I want to do is to be able to support urls like:-

1) http://server/rs/sys/EN/holy%2Fcow
2) http://server/rs/sys/EN/obama%2Ffacing%2Fdemons

Invoking (1) and (2) returns a 400 Bad Request.

An extra question: can the path params support chinese characters ?

-- 
Sincères salutations,
Gavin Bong
Rien ne sert d'être vivant, s'il faut qu'on travaille - André Breton
If you do things well, do them better. Be daring, be first be
different, be just. - Anita Roddick
http://amour.zaadz.com/blog