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

Version:
$Revision: 802700 $

Constructor Summary
MailBinding()
           
MailBinding(HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver)
           
 
Method Summary
protected  void addAttachmentsToMultipart(MimeMultipart multipart, String partDisposition, Exchange exchange)
           
protected  void addBodyToMultipart(MailConfiguration configuration, MimeMultipart activeMultipart, Exchange exchange)
           
protected  void appendAttachmentsFromCamel(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange)
          Appends the Mail attachments from the Camel MailMessage
protected  void appendHeadersFromCamelMessage(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange)
          Appends the Mail headers from the Camel MailMessage
protected  void createMultipartAlternativeMessage(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange)
           
protected  String determineCharSet(MailConfiguration configuration, String charset)
           
protected  String determineContentType(MailConfiguration configuration, Exchange exchange)
           
 Object extractBodyFromMail(Exchange exchange, Message message)
          Extracts the body from the Mail message
protected  Map<String,Object> extractHeadersFromMail(Message mailMessage, Exchange exchange)
           
protected static String getAlternativeBody(MailConfiguration configuration, Exchange exchange)
           
protected static boolean hasAlternativeBody(MailConfiguration configuration, Exchange exchange)
           
protected  String populateContentOnBodyPart(BodyPart part, MailConfiguration configuration, Exchange exchange)
           
protected  String populateContentOnMimeMessage(MimeMessage part, MailConfiguration configuration, Exchange exchange)
           
 void populateMailMessage(MailEndpoint endpoint, MimeMessage mimeMessage, Exchange exchange)
           
protected  void setRecipientFromEndpointConfiguration(MimeMessage mimeMessage, MailEndpoint endpoint)
          Appends the Mail headers from the endpoint configuraiton.
protected  boolean shouldAddAttachment(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(HeaderFilterStrategy headerFilterStrategy,
                   ContentTypeResolver contentTypeResolver)
Method Detail

populateMailMessage

public void populateMailMessage(MailEndpoint endpoint,
                                MimeMessage mimeMessage,
                                Exchange exchange)
                         throws MessagingException,
                                IOException
Throws:
MessagingException
IOException

determineContentType

protected String determineContentType(MailConfiguration configuration,
                                      Exchange exchange)

determineCharSet

protected String determineCharSet(MailConfiguration configuration,
                                  String charset)

populateContentOnMimeMessage

protected String populateContentOnMimeMessage(MimeMessage part,
                                              MailConfiguration configuration,
                                              Exchange exchange)
                                       throws MessagingException,
                                              IOException
Throws:
MessagingException
IOException

populateContentOnBodyPart

protected String populateContentOnBodyPart(BodyPart part,
                                           MailConfiguration configuration,
                                           Exchange exchange)
                                    throws MessagingException,
                                           IOException
Throws:
MessagingException
IOException

extractBodyFromMail

public Object extractBodyFromMail(Exchange exchange,
                                  Message message)
Extracts the body from the Mail message


appendHeadersFromCamelMessage

protected void appendHeadersFromCamelMessage(MimeMessage mimeMessage,
                                             MailConfiguration configuration,
                                             Exchange exchange)
                                      throws MessagingException
Appends the Mail headers from the Camel MailMessage

Throws:
MessagingException

setRecipientFromEndpointConfiguration

protected void setRecipientFromEndpointConfiguration(MimeMessage mimeMessage,
                                                     MailEndpoint endpoint)
                                              throws MessagingException
Appends the Mail headers from the endpoint configuraiton.

Throws:
MessagingException

appendAttachmentsFromCamel

protected void appendAttachmentsFromCamel(MimeMessage mimeMessage,
                                          MailConfiguration configuration,
                                          Exchange exchange)
                                   throws MessagingException,
                                          IOException
Appends the Mail attachments from the Camel MailMessage

Throws:
MessagingException
IOException

addAttachmentsToMultipart

protected void addAttachmentsToMultipart(MimeMultipart multipart,
                                         String partDisposition,
                                         Exchange exchange)
                                  throws MessagingException
Throws:
MessagingException

createMultipartAlternativeMessage

protected void createMultipartAlternativeMessage(MimeMessage mimeMessage,
                                                 MailConfiguration configuration,
                                                 Exchange exchange)
                                          throws MessagingException,
                                                 IOException
Throws:
MessagingException
IOException

addBodyToMultipart

protected void addBodyToMultipart(MailConfiguration configuration,
                                  MimeMultipart activeMultipart,
                                  Exchange exchange)
                           throws MessagingException,
                                  IOException
Throws:
MessagingException
IOException

shouldAddAttachment

protected boolean shouldAddAttachment(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(Message mailMessage,
                                                    Exchange exchange)
                                             throws MessagingException
Throws:
MessagingException

hasAlternativeBody

protected static boolean hasAlternativeBody(MailConfiguration configuration,
                                            Exchange exchange)

getAlternativeBody

protected static String getAlternativeBody(MailConfiguration configuration,
                                           Exchange exchange)


Apache CAMEL