ideals? Also, it shouldn't be terrible for someone to extend Seam Mail with another template provider and use JSF.
I think current mail support can be accepted...I used it in my projects now(Velocity as template)...But I have some questions about this.
1. Is there an example for sending Mail
asynchronously and schedule(CRON), and batch mail sending?
2. In my Seam2 application, I can use a PDF(Seam2 pdf rendering) as attachment directly, how to do this in Seam3?
I have filed the Mail template migrating issue in Seam Mail, but it is rejected. The pdf, rss, xsl, pdf have their own jsf renderkit, these are not available in Seam3.
1. Async is probably not the correct way to go about sending email as there are plenty of documented issues with regards to which scope(s) is active/available in an async thread. Think instead of creating a MailTransporter which can store the message to memory or to disk and then send at a given interval via a timer (EJB/Quartz etc). This gets you protection from the smtp server down as well as near instant send from a client perspective (no blocking of the UI). I can probably work up a blog post shortly with how I'm currently handling this in my apps.
2. JSF style PDF (Seam 2) rendering is not currently a feature of Seam 3. This all relates back to not having a way to render the JSF outside of a web request. Currently you can create a PDF in pure java via iText or other PDF libraries and attach using one of the many attach methods of mail.
Once someone decides to conquer the headless jsf issue, a Templating impl should be able to integrate easily into Seam Mail. See http://java.net/jira/browse/JAVASERVERFACES-1456 and https://issues.jboss.org/browse/SEAMFACES-12 for further info.
This was interesting and may help someone....
Its "odd" to include a whole new system (Velocity) to just send mails from JSF when you should use JSF templates to send email from a SF project.
Sadly; I am just using JEE 6 (not Seam3 (or ApacheSpike etc.)) for my project and have a few "fixes" but getting there...
My biggest missing piece is rendering Mail through a JSF template.
The easiest thing would be to look at Seam 2.3 and use what's there and port it over to EE6.
So there is no problem with "headless" thats been referred to somewhere...
That depends on how you're going to use it. If you're going to do it outside of a JSF request, yes it's a problem. If you're doing it outside of a request, yes it's a problem because JSF was not meant to be used outside of an HTTP request. In Seam2 a very poor mock was used. Something similar could be done, but it's not really a correct way of doing it. The fact that it works, is probably simply coincidental.
A major block was needing to mock the JSF request to support rendering outside a JSF request. For example a large amount of my messages are sent from ejb timers.
I am keen to send one off emails (just registered etc.).
But I was ALSO hoping to do the same thing as Cody suggests (using a timer)... for my NEW project... and this is why....
I found I could send quite a few mails in Seam 2 and then then TXN died... it was one Txn. A few Suggestions were to extend the txn duration; but I just sent less emails to get round the problem As a timer task I can mark the fileds I have sent the email to and carry on each time the timer fires...
I have emailed this thread to lead of JSR 342.
Hopefully it can be absorbed under that...
It does seem crazy to have JSF as part of EE and not use JSF "Templates" to render 'stuff' like email content levereging tables and el etc.
I guess I was "spoilt" with Seam.
A friend says:
> I'd just do a loopback HTTP request to a JSF page to get the content.
Mocking together with classloading was actualy the biggest problem with JSF templating, it would be a big problem if you would wan't to send mail from EJB component that has noting to do with web, there ware lots of hacks and workaround to support this scenarios...
There was some discussion with Mojarra guys to add some mojarra specific apis, that would enable to properly bootstraping of JSF framework without needing to bind it to web lifecycle.
Don't know how far has this come, as when this was disscused it was planed for Mojarra 2.1. Pete would know more on this topic...
Given that if this is now possible to do like that, it would be easy to use JSF for templating even in seam 3...
Cody, yeah, that is the one... couldn't find it earlyer...
Anyhow, this would be the proper way to implement jsf templating, anything else is just hacks with workarounds