You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Paul Mietz Egli (JIRA)" <ji...@apache.org> on 2010/07/14 19:55:52 UTC

[jira] Issue Comment Edited: (CAMEL-2772) camel-jetty can't deal with multiform data rightly

    [ https://issues.apache.org/activemq/browse/CAMEL-2772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60659#action_60659 ] 

Paul Mietz Egli edited comment on CAMEL-2772 at 7/14/10 1:54 PM:
-----------------------------------------------------------------

In case anyone finds this bug and need direction, here's the workaround that I use when processing attachments.  Note that I set the Exchange.FILE_NAME header to the attachment name prior to calling this code, as dh.getName() always seems to return null in Camel 2.3.0:

{code}
DataHandler dh  = exchange.getIn().getAttachment("myfile.txt");
if (dh.getContent() instanceof DataSource) {
    InputStream in = ((DataSource) dh.getContent()).getInputStream();
    String name = dh.getName() != null ? dh.getName() : exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
    String contentType = dh.getContentType();
}
{code}

      was (Author: pegli):
    In case anyone finds this bug and need direction, here's the workaround that I use when processing attachments.  Note that I set the Exchange.FILE_NAME header to the attachment name prior to calling this code, as dh.getName() always seems to return null in Camel 2.3.0:

{code}
        DataHandler dh  = exchange.getIn().getAttachment("myfile.txt");
        if (dh.getContent() instanceof DataSource) {
            InputStream in = ((DataSource) dh.getContent()).getInputStream();
            String name = dh.getName() != null ? dh.getName() : exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
            String contentType = dh.getContentType();
        }
{code}
  
> camel-jetty can't deal with multiform data rightly
> --------------------------------------------------
>
>                 Key: CAMEL-2772
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2772
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-jetty
>    Affects Versions: 2.3.0
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.4.0
>
>
> You can't get the inputStream from the attachment when camel-jetty handle the request of MultiPartForm.
> Here is the mail thread[1] which discusses about it.
> [1] http://old.nabble.com/Unsupported-data-type-exception-with-Jetty-component-tp28730373p28731758.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.