hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Manzoni <manzoni.alessand...@gmail.com>
Subject Re: 400 bad request POSTing to Tomcat 7.0.42
Date Tue, 03 Mar 2015 08:13:25 GMT
Il 02.03.2015 21.45, Brett Ryan ha scritto:
> Hah. If it wasn't for that greek letter we wouldn't have been able to help you optimise
your code, and the bug could have come up at a far more dire time in production.
Yes indeed. Further more, as at test time the bug didn't come up (due to 
a limited set of data supplied by customer), it was already in production!!
What confused me, is that I thought that tomcat should honor the 
encoding set inside xml, while it just use content-type encoding or its 
default one instead.
Usually I use axis with soap services, so I just don't care about 
encoding, this time the server is implementing a sort of post only 
miscontrolled REST service.
>
> Sent from my iPhone
>
>> On 3 Mar 2015, at 03:27, Alessandro Manzoni <manzoni.alessandro4@gmail.com>
wrote:
>>
>> Il 02.03.2015 17.18, Brett Ryan ha scritto:
>>> Actually its not tomcats issue, when sending an encoding other than the default
which is ISO-8859-1 according to RFC-2616 (HTTP/1.1) you should send the encoding type (i.e.
text/xml;charset=utf-8). By default the JAXB marshaller will use UTF-8 encoding when marshalling.
>>>
>>> You can switch Tomcat to use UTF-8 encoding everywhere by default by setting
the URI encoding, adding an encoding filter such as [1](Springs CharacterEncodingFilter) implementation
etc... follow details at [2](the tomcat wiki).
>>>
>>> What I'm guessing was happening was you were sending a character like a copyright
symbol but instead of sending 0xA9 you were sending 0xC2 0xA9
>>>
>>> [1]: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html
>>> [2]: http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q8
>> More or less you guessed well.
>> In fact inside the xml there was a special character (a fi greek letter), but what
I found in wire log, this character had been converted in a string like "[0xd8]" as is (including
brackets). So from my point of view, in that string there weren't spacial characters. Unless
wire log make some kind of formatting to render the content.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message