Vincent Massol wrote:
fyi. Seems like we can now refactor our ubespector to use Sergiu's patch that was committed in Velocity 1.6. Well done Sergiu :)
Also this is very intriguing: "macro libraries to be programatically included when calling template.merge(...)"
-Vincent
Begin forwarded message:
From: "Nathan Bubna" <[email protected]> Date: December 3, 2008 7:04:03 AM CEST To: [email protected], [email protected], [email protected] , [email protected] Subject: [ANNOUNCE] Apache Velocity 1.6
The Apache Velocity Team announces the immediate availability of the of Apache Velocity Engine 1.6. This release is fully compatible with the previous release and includes significant improvements in performance, stability and features.
Apache Velocity is well-known in the Java field as a lightweight, easy-to-use templating library for creating dynamic web sites and performing other text-generation tasks.
Much work in this release has gone to making significant improvements in the memory usage and speed of Velocity. Apart from this, a number of small parser bugs were fixed, tempate/line/column information in error messages has been corrected and made consistent, and many new features were added. Many of the latter are listed below:
* There are three new directives: - #evaluate takes a single string of VTL as an argument and renders it.
Some preliminary testing with a velotool that did that in 1.5 failed because a reference to the velocity context was needed, and it was behind programming rights. I'll try to see if this one works out of the box with the current context.
- #define is a cousin of #macro, that lets define a reference that represents the body of the directive, which is then evaluated when the reference is used. - #break lets you exit a #foreach loop early.
Great!
* There are reflection improvements: - You may now call JDK 1.5 vararg methods on your tools and other references with variable arguments. - You can put a static utility class directly into the context and be able to call its methods; no instance necessary. (e.g. context.put("Math", java.util.Math.class)) - If you have a reference that is an array, you can now call fixed-length list methods on it. (e.g. $array.size() and $array.get($index) ) - There is now support for chaining and linking Uberspect implementations to simplify custom introspection.
* The underlying Velocimacro code has been refactored to allow: - Much, much better performance than Velocity 1.5
Excellent!
- #parse( 'mymacros.vm' ) to work as expected!! - macro libraries to be programatically included when calling template.merge(...)
This was blocking me previously. I'll look into it and start working again on the skin component.
- users to configure a velocimacro.max.depth property (to limit recursion et al)
* CommonsLogLogChute and ServletLogChute are now available without including VelocityTools
* The StringResourceLoader has undergone major refactoring to make it much more user-friendly and flexible.
I must look into this improved version to see if we can sandbox the templates+skins directories, to prevent access to other locations.
* There is now an automatic $velocityHasNext reference in #foreach loops
* You can now configure the connection timeout for URLResourceLoader (JDK 1.5+ only)
Documentation Velocity 1.6 can be found here: http://velocity.apache.org/engine/releases/velocity-1.6/
The change log is here: http://velocity.apache.org/engine/releases/velocity-1.6/changes-report.html
Apache Velocity 1.6 can be downloaded here: http://velocity.apache.org/download.cgi
For the Apache Velocity Team Nathan Bubna
I tried to use a beta a few weeks ago, I saw that some bugs were solved already, and I didn't notice any problems on a simple usage. We should upgrade first thing after 1.7 is released. -- Sergiu Dumitriu http://purl.org/net/sergiu/