users@jersey.java.net

Re: [Jersey] How to capture a possibly variable number of PathParams ?

From: Yoryos <valotas_at_gmail.com>
Date: Sat, 23 Jan 2010 15:43:44 +0200

Did you try regular expressions? Try @Path("{rest: .+}") instead of
@Path("rest").

On Fri, Jan 22, 2010 at 06:13, Gavin Bong <malaisien_at_gmail.com> wrote:

> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>