cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [CForms] Field definitions aren't contextualizable
Date Mon, 16 May 2005 16:21:59 GMT
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("widgets")); 
>
>      }
>
> 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


Mime
View raw message