Author: cbrisson
Date: Sun May 24 16:45:31 2009
New Revision: 778192
URL: http://svn.apache.org/viewvc?rev=778192&view=rev
Log:
activate WebappUberspector by default but deactivate it if not available
Modified:
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/velocity.properties
velocity/tools/trunk/xdocs/changes.xml
Modified:
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=778192&r1=778191&r2=778192&view=diff
==============================================================================
---
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java
(original)
+++
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Sun May 24 16:45:31 2009
@@ -22,6 +22,7 @@
import java.io.InputStream;
import java.io.IOException;
import java.io.Writer;
+import java.util.List;
import javax.servlet.FilterConfig;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -357,7 +358,18 @@
protected void configure(final JeeConfig config, final VelocityEngine
velocity)
{
// first get the default properties, and bail if we don't find them
- velocity.setExtendedProperties(getProperties(DEFAULT_PROPERTIES_PATH,
true));
+ ExtendedProperties defaultProperties =
getProperties(DEFAULT_PROPERTIES_PATH, true);
+ // if using Velocity engine prior to 1.6.x, remove WebappUberspector
+ // (this hack will disappear once tools require Velocity 1.6.x+)
+ try {
+ Class.forName("org.apache.velocity.tools.view.WebappUberspector");
+ } catch(Throwable t) {
+ // remove WebappUberspector from the list of introspectors
+ List introspectors =
defaultProperties.getList(VelocityEngine.UBERSPECT_CLASSNAME);
+
introspectors.remove("org.apache.velocity.tools.view.WebappUberspector");
+
defaultProperties.setProperty(VelocityEngine.UBERSPECT_CLASSNAME,introspectors);
+ }
+ velocity.setExtendedProperties(defaultProperties);
// check for application-wide user props in the context init params
String appPropsPath = servletContext.getInitParameter(PROPERTIES_KEY);
Modified:
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/velocity.properties
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/velocity.properties?rev=778192&r1=778191&r2=778192&view=diff
==============================================================================
---
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/velocity.properties
(original)
+++
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/velocity.properties
Sun May 24 16:45:31 2009
@@ -23,7 +23,6 @@
webapp.resource.loader.class =
org.apache.velocity.tools.view.WebappResourceLoader
string.resource.loader.class =
org.apache.velocity.runtime.resource.loader.StringResourceLoader
-# uncomment (or copy in your velocity.properties file) the following line if
you have Velocity 1.6+
-# and want to access application, session and request attributes via standard
setters, like in:
-# #set($session.foo = 'bar') foo is: $session.foo
-#runtime.introspector.uberspect =
org.apache.velocity.util.introspection.UberspectImpl,org.apache.velocity.tools.view.WebappUberspector
+# allows getting and setting $request, $session and $application attributes
using Velocity syntax,
+# like in #set($session.foo = 'bar'), instead of
$session.setAttribute('foo','bar')
+runtime.introspector.uberspect =
org.apache.velocity.util.introspection.UberspectImpl,org.apache.velocity.tools.view.WebappUberspector
Modified: velocity/tools/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/xdocs/changes.xml?rev=778192&r1=778191&r2=778192&view=diff
==============================================================================
--- velocity/tools/trunk/xdocs/changes.xml (original)
+++ velocity/tools/trunk/xdocs/changes.xml Sun May 24 16:45:31 2009
@@ -31,16 +31,17 @@
<subsection name="2.0-dev">
<p>This section very briefly and generally describes changes after the
1.x series.</p>
<ul>
- <li>More convention over configuration and smart defaults</li>
- <li>New configuration formats (more concise/flexible/powerful xml,
properties, java)</li>
- <li>Entirely new core infrastructure (lazy-loading tools, easier
access, standalone support etc)</li>
- <li>Added VelocityViewTag for JSP integration</li>
- <li>Added DisplayTool, ConversionTool, ClassTool, LoopTool, FieldTool,
a generic version of LinkTool and more</li>
- <li>Refactored and enhanced a number of existing tools</li>
- <li>Improved documentation</li>
- <li>Deprecated many outdated things</li>
- <li>Legacy support for almost all Tools 1.4 configurations and
extensions</li>
- <li>... and lots more. :)</li>
+ <li>More convention over configuration and smart defaults (ndb)</li>
+ <li>New configuration formats (more concise/flexible/powerful xml,
properties, java) (ndb)</li>
+ <li>Entirely new core infrastructure (lazy-loading tools, easier
access, standalone support etc) (ndb)</li>
+ <li>Added VelocityViewTag for JSP integration (ndb)</li>
+ <li>Added DisplayTool, ConversionTool, ClassTool, LoopTool, FieldTool,
a generic version of LinkTool and more (ndb)</li>
+ <li>Refactored and enhanced a number of existing tools (ndb)</li>
+ <li>Improved documentation (ndb)</li>
+ <li>Deprecated many outdated things (ndb)</li> -->
+ <li>Legacy support for almost all Tools 1.4 configurations and
extensions (ndb)</li>
+ <li>Better integration of $application, $session and $request scope
control objects (cbn)</li>
+ <li>and lots more...</li>
</ul>
</subsection>