[Jersey] Re: UriBuilder does not properly encode query parameters?

From: Jakub Podlesak <>
Date: Thu, 22 Aug 2013 11:28:56 +0200

Hi Martynas,

I believe this is not a bug. The hash sign gets encoded,
so that it is not misinterpreted as query string end-delimiter,
otherwise leaving slashes intact is perfectly valid within query string.

To get what you want, you should be able to use something like:

builder.queryParam("mode", "".replaceAll("/","%2F")


On Aug 21, 2013, at 12:12 PM, Martynas Jusevičius <> wrote:

> I'm using Jersey 1.16 by the way. Could this be a bug?
> On Wed, Aug 21, 2013 at 1:09 PM, Martynas Jusevičius
> <> wrote:
>> Hey all,
>> I'm passing URI as query parameter to UriBuilder:
>> builder.queryParam("mode", "")
>> I expect it to get fully URI-encoded, but what I get instead is
>> &mode=
>> where slashes are left unencoded. I tried buildFromEncoded() as well,
>> but the result it the same.
>> Why this weird behavior and how can I work around it?
>> Martynas