users@jersey.java.net

Re: [Jersey] semicolon in path param

From: Craig McClanahan <craigmcc_at_gmail.com>
Date: Tue, 27 Jul 2010 18:26:20 -0700

On Tue, Jul 27, 2010 at 6:10 PM, trolly <trolly.s.rogers_at_gmail.com> wrote:

>
> Hi All - This probably has an obvious solution, but I just can't dig it up.
> I
> have a resource that has a path like this...
>
> /items/{id}
>
> The id path param is a String, and can contain semicolon. It appears that
> path params passed in with semicolons are split, and only the first token
> is
> being returned.


This is because, according to the syntax specification for URLs[1], a
semicolon is used to delimit path parameters in a path segment. If you
really really want to use semicolons, you will need to URL encode them.

Better would be to use some sort of identifier that doesn't use any
characters reserved by the specification (like '/' and ':'), but that's not
always possible.

Craig

[1] http://www.ietf.org/rfc/rfc2396.txt