You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2012/06/01 02:15:18 UTC
Not enough escaping in JAX-RS Proxy objects?
Consider a string containing "ABC News/Washington Post".
If I pass this to a JAX-RS proxy object for an item that maps to a
PathParam, I'd expect that / to be somehow escaped. Instead, we end up
with a URL with too many pieces.
What's to be done, other than moving it to a body payload? If I escape
it myself I've got some problems.
Re: Not enough escaping in JAX-RS Proxy objects?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Benson
On 01/06/12 01:15, Benson Margulies wrote:
> Consider a string containing "ABC News/Washington Post".
>
> If I pass this to a JAX-RS proxy object for an item that maps to a
> PathParam, I'd expect that / to be somehow escaped. Instead, we end up
> with a URL with too many pieces.
>
The values of @Path annotations are passed to UriBuilder.path(Method)
methods, and if these values contain forward "/" slashes then these
slashes are expected to stay un-encoded.
> What's to be done, other than moving it to a body payload? If I escape
> it myself I've got some problems.
UriBuilder can always help, please try:
URI pathUri = UriBuilder.fromPath("").segment("ABC News/Washington
Post").build();
myProxy.getIt(pathUri.toString());
That should work given that a segment value can only have encoded '/'
characters.
perhaps the proxy code should always delegate to UriBuilder.segment,
I'll think about it
Cheers, Sergey