camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-5265) Incorrect Content-Length returned for converted result objects with Unicode characters
Date Thu, 10 May 2012 07:40:15 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-5265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-5265.
--------------------------------

    Resolution: Fixed

Thanks for the patch.

I used the \u0000 for the uni code chars, as people in eg China etc. will have trouble reading
the source code. 

Also I am using the charset value from the exchange, which is what being used to convert the
message to String.
                
> Incorrect Content-Length returned for converted result objects with Unicode characters
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5265
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5265
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-servlet
>    Affects Versions: 2.8.0, 2.9.0
>            Reporter: Manuel Holzleitner
>            Assignee: Claus Ibsen
>              Labels: patch
>             Fix For: 2.8.6, 2.9.3, 2.10.0
>
>         Attachments: patch.diff
>
>
> The camel-servlet component responds with an incorrect http Content-Length header, causing
the HTTP client to retreive a incomplete response, when the body of the out message is of
a POJO type and is converted into a string that contains unicode characters.
> For example, the following route returns "Büe Wör", but should return "Büe Wörld".
> {quote}     
> from("servlet:///testUnicodeWithObjectResponse?matchOnUriPrefix=true") 
>    .process(new Processor() {
>        public void process(Exchange exchange) throws Exception {                    
>            String contentType = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class);
>            exchange.getOut().setHeader(Exchange.CONTENT_TYPE, contentType + "; charset=UTF-8");
 
>     }})
>     .transform(constant(
>         new Object(){
>             @Override
>             public String toString() {
>                 return "Büe Wörld";
>             }
>         }
>     ));
> {quote}
> The attached patch contains a fix for the problem and a test to reproduce the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message