[Jersey] Re: list query params

From: Pedro Nuno Santos <>
Date: Fri, 5 Dec 2014 13:27:12 +0000

* “QueryParamAggregator” should read “MyBeanParam” (copy-paste mistake eheh)


From: Pedro Nuno Santos []
Sent: 05 December 2014 11:49
Subject: [Jersey] Re: list query params

Hi Robert,

You could create a BeanParam that took both List and you own queryparam class (like the stackoverflow link shows) and then provided a single List<String> getValues() method to access the IDs

The BeanParam would have to have some logic to figure out which format was provided (and if both, merge the ids to a single list, choose one or even throw an error) but from the pov of the resource you would only need to do

public Response getSomeStuff(@BeanParam MyBeanParam ids) {
    List<String> list = ids.getValues();

Internally MyBeanParam would look something like this:

public QueryParamAggregator(@QueryParam("id") IdListQueryParam ids,
                            @QueryParam("id") List<String> ids) {
        // Logic to handle the two formats (either merge the lists, prefer one over the
        // other, or throw an error if both are defined)


From: Robert DiFalco []
Sent: 04 December 2014 22:54
Subject: [Jersey] Re: list query params

Thanks! I'd like to support both formats since both are legal. The solution there will only work for the comma delimited form but I will play around with it.

On Thu, Dec 4, 2014 at 2:48 PM, Joakim Tørmoen <<>> wrote:

I dont know if its the best solution, but you can achieve this pretty easily by doing something like this;

Best regards

From: Robert DiFalco [<>]
Sent: 4. desember 2014 23:42
Subject: [Jersey] list query params

It seems like Jersey supports list query params like this:


But not like this:


Is that true or should I be using something other than:

    @QueryParam("id") List ids

According to the table on page 6 of it seems like I should be able to interpret the form of "?id=1,2,3".

Btw, this all came about because I wanted to remove multiple entities in a DELETE command and became aware that (for example) android does not allow sending the ids to delete in the body of DELETE. I can always require the form of "?id=1&id=2&id=3", Jersey seems to handle this well, but it seems verbose.

If you have ideas other than this on bulk DELETE I'd love to hear that too.