users@jersey.java.net

Re: [Jersey] Some weird issue with a combination of Client, WebResource and UriBuilder APIs

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 23 Sep 2008 16:28:55 +0200

I just verified it is a bug... fix on the way...

Paul.

On Sep 23, 2008, at 4:11 PM, Srinivas Naresh Bhimisetty wrote:

> Hi,
>
> I see some weird behavior when I try executing the following code
> fragment:
> ===========================================================
> UriBuilder requestUriBuilder =
> wr.path("resources").path("resource3")
> .path(arg1).path(arg2).getBuilder().queryParam("rep",
> 0);
> URI requestUri = requestUriBuilder.build();
> wr = c.resource(requestUri);
> System.out.println("0:" + requestUri.toURL().toString());
>
> // replace the query param "rep=0" with "rep=1"
> requestUriBuilder = requestUriBuilder.replaceQueryParam("rep",
> 1);
> requestUri = requestUriBuilder.build();
> wr = c.resource(requestUri);
> System.out.println("1:" + requestUri.toURL().toString());
>
> //replace "rep=1" with "rep=2"
> requestUriBuilder = requestUriBuilder.replaceQueryParam("rep",
> 2);
> requestUri = requestUriBuilder.build();
> wr = c.resource(requestUri);
> System.out.println("2:" + requestUri.toURL().toString());
> ==========================================================
>
> The output when I execute the above is something like:
>
> ============================================================
> 0:http://localhost:9988/SimpleServlet/resources/resource3/firstArg/secondArg?rep=0
> 1:http://localhost:9988/SimpleServlet/resources/resource3/firstArg/secondArg?rep=1
> 2:http://localhost:9988/SimpleServlet/resources/resource3/firstArg/secondArg?rep=1&rep=2
> =============================================================
>
> It can be seen that in the third attempt there are two values for
> "rep". Is it something intended?
> Thanks,
> Naresh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>