You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ari King <ar...@gmail.com> on 2012/02/24 19:13:00 UTC

Deserializing Encoded Query String

Hi,

I've configured a method to receive query string parameters (see
below), but it does NOT receive all sent parameters.

public Response lookup (@QueryParam("") CriteriaDto criteria) { ... }

Seemingly encoded parameters are NOT populated in the DTO. For example, given --

Raw query string: ?locations[]=10001&name=ari

Encoded query string: ?locations%5B%5D=10001&name=ari

 The "locations[]" parameter is ignored, whereas "name" is populated
in the CriteriaDto.

I've swapped out jettison for jackson. Does anyone know what could be
wrong? Do I need to change any configurations to handle the url
encoding? Thanks.

-Ari

Re: Deserializing Encoded Query String

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 07/03/12 03:07, Ari King wrote:
>>> I've configured a method to receive query string parameters (see
>>> below), but it does NOT receive all sent parameters.
>>>
>>> public Response lookup (@QueryParam("") CriteriaDto criteria) { ... }
>>>
>>> Seemingly encoded parameters are NOT populated in the DTO. For example,
>>> given --
>>>
>>> Raw query string: ?locations[]=10001&name=ari
>>>
>>> Encoded query string: ?locations%5B%5D=10001&name=ari
>>>
>>>   The "locations[]" parameter is ignored, whereas "name" is populated
>>> in the CriteriaDto.
>>>
>> ? locations=10001
>>
>> should do, even if it's an array property on CriteriaDto
>>
>> Cheers, Sergey
>
> Changing from locations[]=10001 to locations=10001 worked.
>
> But is there a way to make locations[]=10001 work? Thanks.
>

Is having 'locations[]' important for the consumers of the application ?
if yes - then you can use 'locations[]' but it won't work in conjunction 
with the CXF parameter beans support, you'd need to handle the query 
parameters manually...

Cheers, Sergey

> Best,
> Ari


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Re: Deserializing Encoded Query String

Posted by Ari King <ar...@gmail.com>.
>> I've configured a method to receive query string parameters (see
>> below), but it does NOT receive all sent parameters.
>>
>> public Response lookup (@QueryParam("") CriteriaDto criteria) { ... }
>>
>> Seemingly encoded parameters are NOT populated in the DTO. For example,
>> given --
>>
>> Raw query string: ?locations[]=10001&name=ari
>>
>> Encoded query string: ?locations%5B%5D=10001&name=ari
>>
>>  The "locations[]" parameter is ignored, whereas "name" is populated
>> in the CriteriaDto.
>>
> ? locations=10001
>
> should do, even if it's an array property on CriteriaDto
>
> Cheers, Sergey

Changing from locations[]=10001 to locations=10001 worked.

But is there a way to make locations[]=10001 work? Thanks.

Best,
Ari

Re: Deserializing Encoded Query String

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 24/02/12 18:13, Ari King wrote:
> Hi,
>
> I've configured a method to receive query string parameters (see
> below), but it does NOT receive all sent parameters.
>
> public Response lookup (@QueryParam("") CriteriaDto criteria) { ... }
>
> Seemingly encoded parameters are NOT populated in the DTO. For example, given --
>
> Raw query string: ?locations[]=10001&name=ari
>
> Encoded query string: ?locations%5B%5D=10001&name=ari
>
>   The "locations[]" parameter is ignored, whereas "name" is populated
> in the CriteriaDto.
>
? locations=10001

should do, even if it's an array property on CriteriaDto

Cheers, Sergey


> I've swapped out jettison for jackson. Does anyone know what could be
> wrong? Do I need to change any configurations to handle the url
> encoding? Thanks.
>
> -Ari