tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject ExpressionBinding type conversion patch
Date Tue, 18 Nov 2003 16:51:23 GMT
I know I'm a committer, but this is my first change to Tapestry's  
actual functionality... so being a good citizen, I'm asking if the  
below patch is ok to commit or not.  I've tested in on our system and  
it works wonderfully.

The dilemma is that a configured TypeConverter would not be used when  
OgnlUtils is used directly, only for expression bindings.  This is ok  
for our current needs though.

Anyone object to this patch being made?

Thanks,
	Erik


RCS file:  
/home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/binding/ 
ExpressionBinding.java,v
retrieving revision 1.8
diff -u -w -b -r1.8 ExpressionBinding.java
---  
framework/src/org/apache/tapestry/binding/ExpressionBinding.java   4  
Nov 200315:09:37-0000  1.8
+++  
framework/src/org/apache/tapestry/binding/ExpressionBinding.java   18  
Nov 200316:34:58-0000
     private Map getOgnlContext()

     {
-        if (_context == null)
+        if (_context == null) {
             _context = Ognl.createDefaultContext(_root, _resolver);
+        }
+
+        IApplicationSpecification appSpec =  
_root.getPage().getEngine().getSpecification();
+        if (appSpec.checkExtension(Tapestry.OGNL_TYPE_CONVERTER)) {
+            TypeConverter typeConverter = (TypeConverter)  
appSpec.getExtension(Tapestry.OGNL_TYPE_CONVERTER, null);
+            Ognl.setTypeConverter(_context, typeConverter);
+        }

         return _context;
     }

Index: framework/src/org/apache/tapestry/Tapestry.java
     /**
+     * Class name of an {@link ognl.TypeConverter} implementing class
+     * to use as a type converter for {@link  
org.apache.tapestry.binding.ExpressionBinding}
+     */
+    public static final String OGNL_TYPE_CONVERTER =
+        "org.apache.tapestry.ognl-type-converter";
+


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message