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] [Updated] (CAMEL-5265) Incorrect Content-Length returned for transformed result objects with Unicode characters
Date Wed, 09 May 2012 14:15:50 GMT

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

Manuel Holzleitner updated CAMEL-5265:
--------------------------------------

    Description: 
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 to reproduce the problem.

  was:
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.

    
> 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.8.3, 2.8.4, 2.8.5, 2.9.0, 2.9.1, 2.9.2
>            Reporter: Manuel Holzleitner
>              Labels: patch
>             Fix For: 2.10.1
>
>         Attachments: patch.diff
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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 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