camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel Holzleitner (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-5265) Incorrect Content-Length returned for transformed result objects with Unicode characters
Date Wed, 09 May 2012 14:03:49 GMT
Manuel Holzleitner created CAMEL-5265:
-----------------------------------------

             Summary: Incorrect Content-Length returned for transformed 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.9.2, 2.9.1, 2.9.0, 2.8.5, 2.8.4, 2.8.3
            Reporter: Manuel Holzleitner
             Fix For: 2.10.1


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".
            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";
                }
            }

The attached patch contains a fix for the problem and a test that tests the fix.

--
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