The code looks good to me.
Can you check if the stream is right?
Can you dump the stream to see if it is truncated?
Willem
On 4/22/11 9:10 PM, Laurentiu Trica wrote:
Hello,
I use this code:
public class ContentToAttachment extends AbstractTransparentProcessor {
private String contentType = "application/octet-stream";
public void process(Exchange exchange) throws Exception {
Message msg = transferData(exchange);
InputStream stream = (InputStream) msg.getBody();
String attachmentId = (String)
msg.getHeader(UtilConstants.CAMEL_FILENAME_KEY);
if (attachmentId == null){
attachmentId = UtilConstants.CAMEL_FILENAME_KEY;
}
DataHandler handler = new DataHandler(new StreamDataSource(stream,
contentType, attachmentId));
msg.addAttachment(attachmentId, handler);
msg.setBody("");
}
}
Shouldn't this work ok with Camel?
Are there some default length limits for attachments?
On Fri, Apr 15, 2011 at 5:06 AM, Willem Jiang<[email protected]>wrote:
Hi,
How do you setup the attachment?
I don't think converting the message body into attachment will lost the
date.
On 4/14/11 10:08 PM, Laurentiu Trica wrote:
Hello,
I have a problem using Camel Mail. I can get emails with attachments
without
any problem.
But when I send an email with attachment, the attachment gets truncated
and
I see only the last 3KB of it.
I have to add that I construct my attachment from converting the route
content(String) into attachment, if this makes any difference, but I
tested
the "conversion" and nothing disappears in there because using Servicemix
Mail does the trick...
Has anyone any idea about this?
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com