+1
How does Seam implement this?
---
Kito D. Mann | twitter: kito99 | Author, JSF in Action
Virtua, Inc. |
http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter:
jsfcentral
+1 203-404-4848 x3
JSF Summit Conference Dec 1st-4th in Orlando:
http://www.jsfsummit.com
On Thu, Dec 10, 2009 at 1:26 AM, Lincoln Baxter III <lincolnbaxter(a)gmail.com
wrote:
Converters are a great tool, and I use them all the time -- problem
is, I
sometimes need to use more than one converter (rich text processing, for
example) and that leaves me having to write my own converter chain class,
instantiating that class in a bean, then binding it to my Facelet component
through EL.
This seems like a lot of work, when what I'd really like to see is chaining
support out of the box. I see two potential issues to prevent this:
Object -> String
String -> Object
Right now, chains only operate on strings. which could cause some
confusion, potentially, but I see reasons to enable multiple converters per
component, and convert (in list style) in the order in which the converters
were added.
We allow multiple validators, but not multiple converters. This caveat
recently bit me as Kito found out, I was converting URLs into <a> tags as
part of a comment output component. In order to accomplish this, I was
disabling encoding on the component itself, so that the converted output <a>
tag would not be rendered as text. I had attached a converter prior to the
link converter that was supposed to take care of the escaping. Problem is...
the last converter added in the Facelets file wins because only one is
allowed, so my site was (until I fixed it) vulnerable to XSS attacks - a BIG
problem.
I propose adding converter chaining, by default, to UIComponent. In effect,
turning converters into filters. This isn't a hard change, doesn't add much
complexity, but does fix one of those things that people end up having to do
themselves (Seam provides a ConverterChain, and I did some Googling to find
that many other people are doing this themselves.) This is low hanging fruit
that we can pick.
Thoughts?
---
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"