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

Reply via email to