[jboss-cvs] jboss-seam/src/mail/org/jboss/seam/mail/ui ...
Peter Muir
peter at bleepbleep.org.uk
Sun Feb 4 15:58:26 EST 2007
User: pmuir
Date: 07/02/04 15:58:26
Modified: src/mail/org/jboss/seam/mail/ui UIAttachment.java
Log:
Add attachments to example
Revision Changes Path
1.5 +8 -2 jboss-seam/src/mail/org/jboss/seam/mail/ui/UIAttachment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIAttachment.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/mail/org/jboss/seam/mail/ui/UIAttachment.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- UIAttachment.java 4 Feb 2007 12:59:06 -0000 1.4
+++ UIAttachment.java 4 Feb 2007 20:58:26 -0000 1.5
@@ -18,6 +18,7 @@
import javax.mail.internet.MimeBodyPart;
import javax.mail.util.ByteArrayDataSource;
+import org.jboss.seam.pdf.DocumentData;
import org.jboss.seam.pdf.ui.UIDocument;
import org.jboss.seam.ui.JSF;
import org.jboss.seam.util.Resources;
@@ -55,7 +56,6 @@
if (this.getChildren().get(0) instanceof UIDocument) {
UIDocument document = (UIDocument) this.getChildren().get(0);
document.setSendRedirect(false);
- // TODO Set contenttype and filename
JSF.renderChildren(context, this);
} else {
setValue(encode(context).getBytes());
@@ -93,6 +93,12 @@
InputStream is = (InputStream) getValue();
ds = new ByteArrayDataSource(is, getContentType());
}
+ else if (getValue() instanceof DocumentData)
+ {
+ DocumentData documentData = (DocumentData) getValue();
+ ds = new ByteArrayDataSource(documentData.getData(), documentData.getDocType().getMimeType());
+ setFileName(documentData.getFileName());
+ }
else if (getValue() != null && getValue().getClass().isArray())
{
if (getValue().getClass().getComponentType().isAssignableFrom(Byte.TYPE))
@@ -153,7 +159,7 @@
{
if (fileName.lastIndexOf("/") > 0)
{
- return fileName.substring(fileName.lastIndexOf("/"));
+ return fileName.substring(fileName.lastIndexOf("/") + 1);
}
else
{
More information about the jboss-cvs-commits
mailing list