Bug 31869

Summary: Allow DataHandler attachments in the attach tag
Product: Taglibs Reporter: Jamie Flournoy <jamie>
Component: Mailer TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED LATER    
Severity: enhancement    
Priority: P3    
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Jamie Flournoy 2004-10-24 17:59:22 UTC
The 3 supported methods all have problems if you want to dynamically generate a
large personalized document without keeping it on the server indefinitely.
- Making a file means that you have to also develop a reliable method to delete
that file later (but not before the mail has been delivered, and not touching
any newer files that haven't been delivered yet).
- Using a URL means basically using a file, or setting up some sort of internet
server, and developing a mechanism to only allow the mailer to get it. That may
seem simple in a proof-of-concept setup but in a load balanced HTTPS world with
logins and privacy issues there's suddenly a bunch of extra overhead needed to
just attach a file without letting the whole world see it, without getting it
from the wrong server, etc.
- Putting the document inline doesn't work if the attachment is a big binary file.

The most direct and elegant way I can think of to solve this is just to pass a
DataHandler to the attach tag, so you can provide a unique in-memory copy of the
document you're generating and not need to clean anything up, not need to worry
about hostnames and protocols and ports and passwords, and you can pass anything
that JavaMail can handle in a message.

So, I would like to request that the attach tag be enhanced to take a
DataHandler instance - maybe by name of a bean in request scope, like this:

<mt:attach datahandler="myBigDocumentGenerator"/>

where myBigDocumentGenerator is a DataHandler of your own creation that's in
request scope.
Comment 1 Henri Yandell 2009-11-29 19:40:29 UTC
Resolving. Taglib has been retired.