users@jersey.java.net

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

From: Cameron Jones <cmhjones_at_gmail.com>
Date: Thu, 22 Aug 2013 14:59:37 +0100

URI query parameters can contain "/" and "?" as valid unescaped characters,
with some considerations for erroneous implementations:

http://tools.ietf.org/html/rfc3986#section-3.4

The URI encoding in jersey is following the specification whereby once the
hierarchical part of a URI is parsed, some of the reserved characters
restrictions are lifted and so are not escaped.

Cam


On Wed, Aug 21, 2013 at 11:12 AM, Martynas Jusevičius <martynas_at_graphity.org
> 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
> <martynas_at_graphity.org> wrote:
> > Hey all,
> >
> > I'm passing URI as query parameter to UriBuilder:
> >
> > builder.queryParam("mode", "
> http://client.graphity.org/ontology#TableMode")
> >
> > I expect it to get fully URI-encoded, but what I get instead is
> >
> > &mode=http://client.graphity.org/ontology%23TableMode
> >
> > 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
> > graphityhq.com
>