camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Retrieving MailMessage bodies as DataHandler objects
Date Wed, 13 Jan 2010 11:38:12 GMT
Hi

You can get access to the underlying javax.mail.Message
https://svn.apache.org/repos/asf/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java

javax.mail.Message mailMessage = exchange.getIn(MailMessage.class).getMessge();

And maybe there is a type converter for that as well. I cant remember
javax.mail.Message mailMessage = exchage.getIn().getBody(javax.mail.Message);



On Wed, Jan 13, 2010 at 11:47 AM, huntc <huntc@mac.com> wrote:
>
> Hi there,
>
> Supposing that I receive an Exchange using Camel Mail and I want to see
> whether the body is of the required MIME type; is it valid to do this:
>
>  // See if our exchange body contains the calendar object.
>  DataHandler bodyDataHandler = exchange.getIn().getBody(
>                DataHandler.class);
>  if (bodyDataHandler != null) {
>    ...
>  }
>
> I know that I can retrieve attachments as DataHandlers, but am I able to do
> so for the body itself? The documentation implies that the body is coerced
> to a string...
>
> I have already incorporated the above code in my application and I'm waiting
> for someone to send the type of message that may also answer this post.
> However it'll be several hours before I know.
>
> Thanks!
>
> Kind regards,
> Christopher
> --
> View this message in context: http://old.nabble.com/Retrieving-MailMessage-bodies-as-DataHandler-objects-tp27142905p27142905.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message