users@jersey.java.net

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

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Thu, 1 Aug 2013 09:43:52 +0200

Hi Guy,

this seems like a bug to me.
Could you please file a JIRA issue against the proxy client?:

http://java.net/jira/browse/JERSEY

Thanks,

~Jakub

On Jul 31, 2013, at 12:36 AM, Guy Rouillier <guy.rouillier_at_gmail.com> wrote:

> 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