cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: ISO-8859-1 encoded parameters in application/x-www-form-urlencoded requests
Date Fri, 05 Dec 2014 10:59:18 GMT
Hi
On 05/12/14 09:55, Jose María Zaragoza wrote:
> Hello:
>
> I'm using CXF 2.7.8 to deploy a webservice and to process
> application/x-www-form-urlencoded content-type POST requests
>
> My webservice is receiving this request
>
> Encoding: ISO-8859-1
> Http-Method: POST
> Content-Type: application/x-www-form-urlencoded
> Headers: {content-type=[application/x-www-form-urlencoded],
> host=[x.x,x,x], user-agent=[Java/1.7.0_25]}
> Payload:agentId=5490424&name=Jos%E1+Maria
>
> %E1 corresponds to  tittle-e character ( Spanish é ) ISO-8859-1 encoded
> But my CXF service waits UTF-8  encoded characters , so it doesn't
> decode it correctly
>
> But if  I send
> Content-Type: "application/x-www-form-urlencoded; charset=ISO-8859-1"
>
> all works fine
>
> is this the correct/standard compliant behaviour ?
>
I don't know if JAX-RS consumers are expected to check the Encoding 
header if a Content-Type charset attribute is missing; I'd say no 
because only Accept-Encoding is listed in the list of headers processed 
by the runtime and only if a Request context is used.

It may make sense to get more clarity on it in the specification text 
though, if the intersected media type is missing a charset then indeed, 
why not check Encoding

> As a workaround , can I modify my service to decode ISO-8859-1
> characters without forcing to my clients to send charset=ISO-8859-1
> header ?
>
Try @Consumes("application/x-www-form-urlencoded;charset=ISO-8859-1")

Cheers, Sergey

> Thanks and regards
>



Mime
View raw message