Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.8.0, 2.9.0
-
Patch Available
-
Unknown
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()Unknown macro: { return "Büe Wörld"; }}
));
The attached patch contains a fix for the problem and a test to reproduce the problem.