camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-8941) Restlet supports binary files only with media type application/octet-stream
Date Wed, 08 Jul 2015 07:51:04 GMT

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

Claus Ibsen updated CAMEL-8941:
-------------------------------
    Issue Type: Improvement  (was: Bug)

> Restlet supports binary files only with media type application/octet-stream 
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-8941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8941
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-restlet
>    Affects Versions: 2.15.2
>            Reporter: Anton Koscejev
>             Fix For: 2.16.0
>
>
> 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:
> {code}
> 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);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message