[seam-dev] Let me know what you need for a first stab at the PDF/Mail port from Seam 2

Nikolay Elenkov nick at sarion.co.jp
Mon May 24 22:01:53 EDT 2010


On 2010/05/25 3:06, Gavin King wrote:
> And, of course, this is why facelets is so appropriate for the task:
> facelets was designed not for text rendering, but for object graph
> construction. JSP and Velocity just render text.
> 
> On Mon, May 24, 2010 at 1:04 PM, Gavin King <gavin.king at gmail.com> wrote:
>> I just don't buy this. On the contrary, the Seam mail functionality is
>> NOT just rendering a bit of text, which is what I tried to explain,
>> but nobody seems to be "getting". The template actually builds an
>> object, with to/from addresses, a subject line, headers, etc.
>>

That's one of the problems with it. It does too much. As I said before, email is
not a document, it is a message. It has recipients, reply-to, headers, subject
and body. If people want to customize it, they would like to customize the body
and maybe the subject. Headers and recipients are generated by the program and
you don't usually want to touch those. The current implementation
squishes all that together in one xml template (which happens to be
facelets/JSF). IMHO, this is not a good idea.

Another thing the current implementation does is render and send at the same
time. This is a bad idea as well. You'd generally want to save the rendered
email, and retry on send errors. The current implementation is driven by JSF,
and hides those things from you (if you go out of your way, you can get them,
but in this case the framework is working against you).

Again, what templating engine to use is not the main problem. The main points are:

* make it pluggable
* make it modular
* do not depend on JSF/reply/request, so that you can call it asynchronously
* separate rendering from sending/routing.
* make it easier to test (yes, I know we have MockTransport

And please don't take my word for it, just do a search on the Seam forums. The
majority of questions on Seam mail are:

* how to send to multiple recipients (use a faclets loop to add multiple to:s,
really?)
* how to send from JMS/async (I can't access my contexts! It doesn't work!: Oh,
now I have this hack that makes it work.: repeat...)
* how to save the rendered message (you can't; write a custom JavaMail transport)
* how to retry if sending fails (catch this JSF exception, look at the cause,
maybe if you are lucky, you will find the cause...)

So right now, Seam mail gets in the way more than it helps. If Seam3 is going to
be better, things have to be changed, not just ported over, because that's how
it used to be in Seam 2. The templating engine is just one part of the problem,
and not the main one.



More information about the seam-dev mailing list