org.apache.camel.component.mail
Class MailBinding

java.lang.Object
  extended by org.apache.camel.component.mail.MailBinding

public class MailBinding
extends Object

A Strategy used to convert between a Camel Exchange and Message to and from a Mail MimeMessage


Constructor Summary
MailBinding()
           
MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver)
           
 
Method Summary
protected  void addAttachmentsToMultipart(javax.mail.internet.MimeMultipart multipart, String partDisposition, org.apache.camel.Exchange exchange)
           
protected  void addBodyToMultipart(MailConfiguration configuration, javax.mail.internet.MimeMultipart activeMultipart, org.apache.camel.Exchange exchange)
           
protected  void appendAttachmentsFromCamel(javax.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange)
          Appends the Mail attachments from the Camel MailMessage
protected  void appendHeadersFromCamelMessage(javax.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange)
          Appends the Mail headers from the Camel MailMessage
protected  void createMultipartAlternativeMessage(javax.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
protected static String determineCharSet(MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
protected  String determineContentType(MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
 void extractAttachmentsFromMail(javax.mail.Message message, Map<String,DataHandler> map)
          Parses the attachments of the given mail message and adds them to the map
protected  void extractAttachmentsFromMultipart(javax.mail.Multipart mp, Map<String,DataHandler> map)
           
 Object extractBodyFromMail(org.apache.camel.Exchange exchange, MailMessage mailMessage)
          Extracts the body from the Mail message
protected  Map<String,Object> extractHeadersFromMail(javax.mail.Message mailMessage, org.apache.camel.Exchange exchange)
           
protected static String getAlternativeBody(MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
protected static boolean hasAlternativeBody(MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
protected  String populateContentOnBodyPart(javax.mail.BodyPart part, MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
protected  String populateContentOnMimeMessage(javax.mail.internet.MimeMessage part, MailConfiguration configuration, org.apache.camel.Exchange exchange)
           
 void populateMailMessage(MailEndpoint endpoint, javax.mail.internet.MimeMessage mimeMessage, org.apache.camel.Exchange exchange)
           
protected  void setRecipientFromEndpointConfiguration(javax.mail.internet.MimeMessage mimeMessage, MailEndpoint endpoint, org.apache.camel.Exchange exchange)
          Appends the Mail headers from the endpoint configuration.
protected  boolean shouldAddAttachment(org.apache.camel.Exchange exchange, String attachmentFilename, DataHandler handler)
          Strategy to allow filtering of attachments which are added on the Mail message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailBinding

public MailBinding()

MailBinding

public MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy,
                   ContentTypeResolver contentTypeResolver)
Method Detail

populateMailMessage

public void populateMailMessage(MailEndpoint endpoint,
                                javax.mail.internet.MimeMessage mimeMessage,
                                org.apache.camel.Exchange exchange)
                         throws javax.mail.MessagingException,
                                IOException
Throws:
javax.mail.MessagingException
IOException

determineContentType

protected String determineContentType(MailConfiguration configuration,
                                      org.apache.camel.Exchange exchange)

determineCharSet

protected static String determineCharSet(MailConfiguration configuration,
                                         org.apache.camel.Exchange exchange)

populateContentOnMimeMessage

protected String populateContentOnMimeMessage(javax.mail.internet.MimeMessage part,
                                              MailConfiguration configuration,
                                              org.apache.camel.Exchange exchange)
                                       throws javax.mail.MessagingException,
                                              IOException
Throws:
javax.mail.MessagingException
IOException

populateContentOnBodyPart

protected String populateContentOnBodyPart(javax.mail.BodyPart part,
                                           MailConfiguration configuration,
                                           org.apache.camel.Exchange exchange)
                                    throws javax.mail.MessagingException,
                                           IOException
Throws:
javax.mail.MessagingException
IOException

extractBodyFromMail

public Object extractBodyFromMail(org.apache.camel.Exchange exchange,
                                  MailMessage mailMessage)
Extracts the body from the Mail message


extractAttachmentsFromMail

public void extractAttachmentsFromMail(javax.mail.Message message,
                                       Map<String,DataHandler> map)
                                throws javax.mail.MessagingException,
                                       IOException
Parses the attachments of the given mail message and adds them to the map

Parameters:
message - the mail message with attachments
map - the map to add found attachments (attachmentFilename is the key)
Throws:
javax.mail.MessagingException
IOException

extractAttachmentsFromMultipart

protected void extractAttachmentsFromMultipart(javax.mail.Multipart mp,
                                               Map<String,DataHandler> map)
                                        throws javax.mail.MessagingException,
                                               IOException
Throws:
javax.mail.MessagingException
IOException

appendHeadersFromCamelMessage

protected void appendHeadersFromCamelMessage(javax.mail.internet.MimeMessage mimeMessage,
                                             MailConfiguration configuration,
                                             org.apache.camel.Exchange exchange)
                                      throws javax.mail.MessagingException,
                                             IOException
Appends the Mail headers from the Camel MailMessage

Throws:
javax.mail.MessagingException
IOException

setRecipientFromEndpointConfiguration

protected void setRecipientFromEndpointConfiguration(javax.mail.internet.MimeMessage mimeMessage,
                                                     MailEndpoint endpoint,
                                                     org.apache.camel.Exchange exchange)
                                              throws javax.mail.MessagingException,
                                                     IOException
Appends the Mail headers from the endpoint configuration.

Throws:
javax.mail.MessagingException
IOException

appendAttachmentsFromCamel

protected void appendAttachmentsFromCamel(javax.mail.internet.MimeMessage mimeMessage,
                                          MailConfiguration configuration,
                                          org.apache.camel.Exchange exchange)
                                   throws javax.mail.MessagingException,
                                          IOException
Appends the Mail attachments from the Camel MailMessage

Throws:
javax.mail.MessagingException
IOException

addAttachmentsToMultipart

protected void addAttachmentsToMultipart(javax.mail.internet.MimeMultipart multipart,
                                         String partDisposition,
                                         org.apache.camel.Exchange exchange)
                                  throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

createMultipartAlternativeMessage

protected void createMultipartAlternativeMessage(javax.mail.internet.MimeMessage mimeMessage,
                                                 MailConfiguration configuration,
                                                 org.apache.camel.Exchange exchange)
                                          throws javax.mail.MessagingException,
                                                 IOException
Throws:
javax.mail.MessagingException
IOException

addBodyToMultipart

protected void addBodyToMultipart(MailConfiguration configuration,
                                  javax.mail.internet.MimeMultipart activeMultipart,
                                  org.apache.camel.Exchange exchange)
                           throws javax.mail.MessagingException,
                                  IOException
Throws:
javax.mail.MessagingException
IOException

shouldAddAttachment

protected boolean shouldAddAttachment(org.apache.camel.Exchange exchange,
                                      String attachmentFilename,
                                      DataHandler handler)
Strategy to allow filtering of attachments which are added on the Mail message


extractHeadersFromMail

protected Map<String,Object> extractHeadersFromMail(javax.mail.Message mailMessage,
                                                    org.apache.camel.Exchange exchange)
                                             throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

hasAlternativeBody

protected static boolean hasAlternativeBody(MailConfiguration configuration,
                                            org.apache.camel.Exchange exchange)

getAlternativeBody

protected static String getAlternativeBody(MailConfiguration configuration,
                                           org.apache.camel.Exchange exchange)


Apache CAMEL