Why isn't the org.apache.cocoon.components.LifecycleHelper used? That should hide all those details.
> -----Oorspronkelijk bericht----- > Van: Sylvain Wallez [mailto:[EMAIL PROTECTED] > Verzonden: maandag 16 mei 2005 18:22 > Aan: dev@cocoon.apache.org > Onderwerp: Re: [CForms] Field definitions aren't contextualizable > > Ugo Cei wrote: > > > In trying to implement a CAPTCHA validator for CForms, I found out > > that I needed to to store an attribute in the session from a field > > definition builder and I discovered that even if my class extending > > AbstractDatatypeWidgetDefinitionBuilder implemented Contextualizable, > > its contextualize method was never called. > > > > After a little debugging, I discovered that the DefaultFormManager > > instantiates a SimpleComponentSelector directly but does not > > contextualize it. So, the SimpleComponentSelector cannot contextualize > > the widget builders that it creates in turn. > > > > OK, to make it short, I locally did a quick fix (against 2.1.8-dev): > > > > Index: > > src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java > > =================================================================== > > --- > > src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java > > (revision 170351) > > +++ > > src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java > > (working copy) > > @@ -104,6 +104,7 @@ > > manager.release(service); > > } > > }); > > + widgetDefinitionBuilderSelector.contextualize(avalonContext); > > > > > widgetDefinitionBuilderSelector.configure(configuration.getChild("widget s" > )); > > > > } > > > > I'm not sure this is the right thing to do. Would someone who is more > > knowledgeable of CForms internals please review this, so that I can > > apply it? > > > Looks ok, except that contextualize() comes before service() in the > Avalon lifecycle. > > Sylvain > > > -- > Sylvain Wallez Anyware Technologies > http://apache.org/~sylvain http://anyware-tech.com > Apache Software Foundation Member Research & Technology Director