Details
-
Type:
Improvement
-
Status: Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.15.2
-
Fix Version/s: 2.16.0
-
Component/s: camel-restlet
-
Labels:None
-
Estimated Complexity:Unknown
Description
The camel-restlet component populates Camel Exchange from Restlet Response via DefaultRestletBinding. However, it only properly reads binary contents if media type is "application/octet-stream". In all other cases it reads contents as String, even if contents are binary. For example, if the contents are of type "audio/wave" - a normal .wav file returned by a REST service - they would be read as a String, which results in an unplayable file.
See code extract:
if (mediaType != null && mediaType.equals(MediaType.APPLICATION_OCTET_STREAM)) { exchange.getOut().setBody(response.getEntity().getStream()); } else if (response.getEntity() instanceof Representation) { Representation representationDecoded = new DecodeRepresentation(response.getEntity()); exchange.getOut().setBody(representationDecoded.getText()); } else { // get content text by default String text = response.getEntity().getText(); LOG.debug("Populate exchange from Restlet response: {}", text); exchange.getOut().setBody(text); }
Attachments
Issue Links
- relates to
-
CAMEL-7757 camel-restlet 2.13.1 throwing EOFException on reading ZipInputStream
-
- Resolved
-
-
CAMEL-8078 camel-restlet should support to decode the response entity which is represent resource
-
- Resolved
-