users@jersey.java.net

Re: How to retrieve list of resources - use MatrixParams?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 17 Mar 2008 14:24:43 +0100

Marc Hadley wrote:
> On Mar 11, 2008, at 4:22 AM, Martin Grotzke wrote:
>>
>> thanx for your feedback! Would it be easier if I used s.th.
>> like /products/123,234,345?
>>
> Easiest would be something like
>
> /products?p=123&p=234&p=345
>
> then you could use
>
> UriInfo.getQueryParameters.get("p")
>
> which returns a List<String> with values {"123","234","345"}
>

You can also do:

   @GET public String get(@QueryParam("p") List<String> q) { ... }

or

   @GET public String get(@QueryParam("p") List<Integer> q) { ... }

To get the list. Same goes for matrix params as well.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109