[seam-commits] Seam SVN: r8264 - in trunk: src/mail/org/jboss/seam/mail/ui and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu May 22 08:31:16 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-05-22 08:31:15 -0400 (Thu, 22 May 2008)
New Revision: 8264
Modified:
trunk/examples/mail/view/attachment.xhtml
trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java
trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java
trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
Log:
JBSEAM-2187
Modified: trunk/examples/mail/view/attachment.xhtml
===================================================================
--- trunk/examples/mail/view/attachment.xhtml 2008-05-22 11:43:38 UTC (rev 8263)
+++ trunk/examples/mail/view/attachment.xhtml 2008-05-22 12:31:15 UTC (rev 8264)
@@ -6,7 +6,7 @@
<m:from name="Seam" address="do-not-reply at jboss.com" />
<m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
<m:subject>Try out Seam!</m:subject>
- <m:attachment value="/jboss.jpg" status="jbossLogo" />
+ <m:attachment value="/jboss.jpg" status="jbossLogo" disposition="inline" />
<m:attachment value="#{numbers}" />
<m:attachment value="#{person.photo}" contentType="image/png" fileName="#{person.firstname}_#{person.lastname}.jpg" disposition="inline" />
<m:attachment fileName="whyseam.pdf">
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java 2008-05-22 11:43:38 UTC (rev 8263)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java 2008-05-22 12:31:15 UTC (rev 8264)
@@ -167,7 +167,7 @@
attachment.setDataHandler(new DataHandler(ds));
attachment.setFileName(getName(ds.getName()));
attachment.setDisposition(getDisposition());
- super.getRootMultipart().addBodyPart(attachment);
+ findMessage().getAttachments().add(attachment);
if (getStatus() != null)
{
AttachmentStatus attachmentStatus = new AttachmentStatus();
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java 2008-05-22 11:43:38 UTC (rev 8263)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java 2008-05-22 12:31:15 UTC (rev 8264)
@@ -58,6 +58,18 @@
{
bodyPart = getHtmlBody(facesContext, body);
}
+
+ if (findMessage().getAttachments().size() > 0)
+ {
+ MimeMultipart bodyRootMultipart = new MimeMultipart("related");
+ bodyRootMultipart.addBodyPart(bodyPart, 0);
+ for (MimeBodyPart attachment: findMessage().getAttachments())
+ {
+ bodyRootMultipart.addBodyPart(attachment);
+ }
+ bodyPart = new MimeBodyPart();
+ bodyPart.setContent(bodyRootMultipart);
+ }
}
getRootMultipart().addBodyPart(bodyPart, 0);
}
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java 2008-05-22 11:43:38 UTC (rev 8263)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java 2008-05-22 12:31:15 UTC (rev 8264)
@@ -3,6 +3,8 @@
import static org.jboss.seam.util.Strings.isEmpty;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -10,6 +12,7 @@
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
+import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
@@ -35,6 +38,8 @@
}
private MimeMessage mimeMessage;
+
+ List<MimeBodyPart> attachments = new ArrayList<MimeBodyPart>();
private Session session;
@@ -297,4 +302,14 @@
this.messageId = messageId;
}
+ public List<MimeBodyPart> getAttachments()
+ {
+ return attachments;
+ }
+
+ public void setAttachments(List<MimeBodyPart> attachments)
+ {
+ this.attachments = attachments;
+ }
+
}
More information about the seam-commits
mailing list