users@jersey.java.net

[Jersey] Re: PathParam list parameter url

From: Srinivas Naresh Bhimisetty <shri.naresh_at_gmail.com>
Date: Thu, 30 Dec 2010 14:19:13 +0530

Why not take the path parameter as a comma-separated string and return the
list by splitting it?

- Naresh

On Wed, Dec 29, 2010 at 11:09 PM, mauricio munoz
<gmauricio.munoz_at_gmail.com>wrote:

> Hello all,
>
> I want to know how do I pass a parameter as a list to a resource method. I
> know that I can have a list as a PathParam, but I don't know how should I
> pass the list on the url.
>
> I want to be able to call a service like this:
>
> @GET
> @Path("/somepath/{ids}")
> public List<Long> showList(@PathParam("ids") List<Long> ids) {
> return ids;
> }
>
> It seems like my method is ok. I was trying with something like /myresource/somepath/1,2,3,4
> expecting to get the {1,2,3,4} list but it didn't work.
>
> Any help would be greatly appreciated.
>
> --
> Germán Mauricio Muñoz
>
>