Hi,
I just looked at the code on master
https://github.com/apache/camel/blob/camel-2.14.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
This code is different than the one in camel-restlet 2.14.0. Someone updated
the file 5 days ago.
*The method starts at line number 311 on Master *. Below is the method from
Master that I was talking about and it's the same as in 2.14.0
public void populateExchangeFromRestletResponse(Exchange exchange, Response
response) throws Exception {
for (Map.Entry<String, Object> entry : response.getAttributes().entrySet())
{
String key = entry.getKey();
Object value = entry.getValue();
if (!headerFilterStrategy.applyFilterToExternalHeaders(key, value,
exchange)) {
exchange.getOut().setHeader(key, value);
LOG.debug("Populate exchange from Restlet response header: {} value: {}",
key, value);
}
}
// set response code
int responseCode = response.getStatus().getCode();
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
// set restlet response as header so end user have access to it if needed
exchange.getOut().setHeader(RestletConstants.RESTLET_RESPONSE, response);
if (response.getEntity() != null) {
// get content type
MediaType mediaType = response.getEntity().getMediaType();
if (mediaType != null) {
LOG.debug("Setting the Content-Type to be {}", mediaType.toString());
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, mediaType.toString());
}
if (mediaType != null &&
mediaType.equals(MediaType.APPLICATION_OCTET_STREAM)) {
exchange.getOut().setBody(response.getEntity().getStream());
}* else {
// get content text
String text = response.getEntity().getText();
LOG.debug("Populate exchange from Restlet response: {}", text);
exchange.getOut().setBody(text);
}*
}
// preserve headers from in by copying any non existing headers
// to avoid overriding existing headers with old values
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), false);
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-Restlet-2-14-0-DecodeRepresentation-tp5759382p5759542.html
Sent from the Camel - Users mailing list archive at Nabble.com.