users@jersey.java.net

[Jersey] jersey-proxy-client not properly serializing QueryParam List<T>

From: Guy Rouillier <guy.rouillier_at_gmail.com>
Date: Tue, 30 Jul 2013 18:36:52 -0400

I've been happily using the jersey-proxy-client in our home-grown web
services. Thanks very much for producing such a useful feature. We're
still using 1.x for one project and 2.x for a new project we just
started; we're using the proxy in both of them.

I've just run into a problem trying to pass a list of values in a
QueryParam. According to what I've found searching online, the JAX-RS
specification (section 3.2) says the following regarding the @QueryParam
annotation:

The following types are supported:

     (1) Primitive Types
     (2) Types that have a constructor that accepts a single String
argument.
     (3) Types that have a static method named valueOf with a single
String argument.
     (4) List<T>, Set<T>, or SortedSet<T> where T satisfies 2 or 3 above.

I'm attempting to use (4) to pass a list of enum values:

      @QueryParam("severity") List<TicketSeverityEnum> severityList

However, the proxy client is serializing this as

      &severity=[1,+3,+5]

When this gets to the server, the deserialization process interprets
this as a single value instead of a list of three, and the
deserialization fails.

I took the resulting URI and manually changed it to include this:

      &severity=1&severity=3&severity=5

The server is able to properly deserialize these three separate values
into the severityList.

Is this a bug in the proxy? Seems like it should be able to use the
second approach to serializing.

Thanks.

-- 
Guy Rouillier