atom feed6 messages in net.java.dev.jersey.usersRe: [Jersey] MultivaluedMap
FromSent OnAttachments
Ronak PatelOct 27, 2009 7:35 pm 
Paul SandozOct 27, 2009 11:44 pm 
Ronak PatelOct 28, 2009 6:41 am 
Paul SandozOct 28, 2009 7:48 am 
Ronak PatelOct 28, 2009 10:35 am 
Paul SandozOct 28, 2009 10:46 am 
Subject:Re: [Jersey] MultivaluedMap
From:Ronak Patel (rona@yahoo.com)
Date:Oct 28, 2009 6:41:24 am
List:net.java.dev.jersey.users

Paul,

I'm using Jersey version 1.0.3.1.

I tried doing put and add with the same result. I even tried to loop through the
String array on my own and add one at a time.

Ronak

________________________________ From: Paul Sandoz <Paul@Sun.COM> To: use@jersey.dev.java.net Sent: Tue, October 27, 2009 11:44:47 PM Subject: Re: [Jersey] MultivaluedMap

Hi Ronak,

What version of Jersey are you using?

I tried a quick test with 1.1.4-ea-SNAPSHOT and it worked as you expect. There
is no code to explicitly write "," in the URI builder implementation.

BTW you can also do the following which is equivalent:

resource.queryParam("id", "hello").queryParam("id",
"there").get(ClientResponse.class);

Are you sure you did not do:

queryParams.add("id", Arrays.asList(new String[]{"hello", "there"}));

?

which will create query string:

?id=%5Bhello,+there%5D

Paul.

Paul,

I have a quite a basic question which I am embarrassed to ask but one I've been
scratching my head about...

I'm using MultivaluedMap and MultivaluedMapImpl to set my queryParams on the
JAX-RS Jersey Client API

and I don't see Jersey formulate my expected url.

I am doing as so:

Client client = Client.create(); WebResource resource = client.resource("http://somehost.com/someuri"); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();

queryParams.put("id", Arrays.asList(new String[]{"hello", "there"}));

resource.queryParams(queryParams).get(ClientResponse.class);

Now, I don't see Jersey formulate the list of parameters as
id=hello&id=there...and instead I see id=hello,there which is not what I want.

What should I be doing to obtain a url with id=hello&id=there?

Thanks,

Ronak