cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject [CForms] Field definitions aren't contextualizable
Date Mon, 16 May 2005 13:53:53 GMT
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?

	Thanks a lot,

		Ugo

Mime
View raw message