users@jersey.java.net

Re: [Jersey] UriBuilder.segments() with semicolon

From: Trygve Laugstøl <trygvis_at_inamo.no>
Date: Wed, 22 Jul 2009 13:20:32 +0200

Paul Sandoz wrote:
>
> On Jul 22, 2009, at 5:47 AM, Igor Minar wrote:
>
>> semicolon is a valid path (segment) separator (just like '/'), so I
>> assume that's why it is not being encoded.
>>
>
> I think this is an issue. The following:
>
> URI u =
> UriBuilder.fromPath("/a/b").segment("x;y").matrixParam("e;f",
> "g;h").build();
> System.out.println(u);
>
> outputs:
>
> /a/b/x;y;e;f=g;h
>
> I think segment should percent encode ";" as should be the case for
> matrix parameter names/values.
>
> One can use the path method when ";" is not meant to be percent encoded.

Yeah, that's what I read from the docs too. So should I file a bug?

--
Trygve
> Paul.
> 
>> /i
>>
>> On Jul 21, 2009, at 6:12 PM, Trygve Laugstøl wrote:
>>
>>> Howdy
>>>
>>> I'd like to generate a path to an object with a semicolon:
>>>
>>> http://.../sessions/I like to eat cows; however, I don't like to be 
>>> eaten by them
>>>
>>> I use UriBuilder.segments("I like to eat cows; however, I don't like 
>>> to be eaten by them") and would expect the semicolon to be escaped to 
>>> %3b, but it's not.
>>>
>>> Is that expected behavior? Is there a better/proper way to encode 
>>> such paths?