cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: @Encoded jaxrs client problems
Date Thu, 18 Sep 2014 08:48:40 GMT
Hi
On 17/09/14 22:40, Osvaldo Pina wrote:
> I thought that by using @Encoded in client the value would be automatically
> encoded. For example:
>
> consider this method:
> @Path("{path}")
> @GET
> String getPath(@Encoded @PathParam("path") String path);
>
> If I call call this method using a slashed value on the path param (
> client.getPath("/value/with-slash")  ) I tought that the value would be
> automatically encoded (from /value/with-slash to %2Fvalue%2Fwith-slash) so
> that the slashes in the string would not be confused to the path uri
> template.
>
'/' is not expected to be encoded by default in a URI path component
> Is there any way to inform CXF client that I want to encode a parameter?
You can use UriBuilder and prepare an encoded path value - UriBuilder 
should take care of it, you can use its segment() method which would 
encode '/' or a new method there accepting a boolean flag on whether to 
encode a slash or not...

It is only the issue for '/'
client.getPath("value with space") should get "value%20with%20space" 
produced


Cheers, Sergey
>
> Thanks,
> Osvaldo Pina.
>
> On Wed, Sep 17, 2014 at 5:55 PM, Sergey Beryozkin <sberyozkin@gmail.com>
> wrote:
>
>> Hi
>> On 17/09/14 20:22, Osvaldo Pina wrote:
>>
>>> Hi,
>>>
>>> I'm trying to use @Encoded in client jaxrs method parameters and it's no
>>> working. Did I miss something or the feature is not avaliable to cxf jaxrs
>>> clients?
>>>
>>>   What exactly does not work ? I do not recall doing anything around
>> @Encoded on the client proxy side, its semantics on the server is that a
>> given value does not have to kept as is, no attempt to decode should be
>> made.
>> Do you have something not encoded properly by the proxy ?
>>
>> Cheers, Sergey
>>
>>>
>>> Thanks,
>>> Osvaldo Pina.
>>>
>>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Mime
View raw message