velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r584486 - in /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view: ContextTool.java tools/ContextTool.java
Date Sun, 14 Oct 2007 04:47:38 GMT
Author: nbubna
Date: Sat Oct 13 21:47:37 2007
New Revision: 584486

URL: http://svn.apache.org/viewvc?rev=584486&view=rev
Log:
update key for safe mode param while still supporting the old one

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/tools/ContextTool.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java?rev=584486&r1=584485&r2=584486&view=diff
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
(original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
Sat Oct 13 21:47:37 2007
@@ -67,7 +67,7 @@
     /**
      * The key used for specifying whether to hide keys with '.' in them.
      */
-    public static final String SAFE_MODE_KEY = "safe-mode";
+    public static final String SAFE_MODE_KEY = "safeMode";
 
     protected ViewContext context;
     protected Map toolbox;

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/tools/ContextTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/tools/ContextTool.java?rev=584486&r1=584485&r2=584486&view=diff
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/tools/ContextTool.java
(original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/tools/ContextTool.java
Sat Oct 13 21:47:37 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.util.Map;
 import org.apache.velocity.tools.view.ViewContext;
 
 /**
@@ -29,6 +30,9 @@
     org.apache.velocity.tools.view.ContextTool
 {
     @Deprecated
+    public static final String OLD_SAFE_MODE_KEY = "safe-mode";
+
+    @Deprecated
     public void init(Object obj)
     {
         if (obj instanceof ViewContext)
@@ -39,4 +43,21 @@
             this.application = context.getServletContext();
         }
     }
+
+    @Override
+    public void configure(Map params)
+    {
+        if (params != null)
+        {
+            // if we find a param under the old key
+            Object oldSafeMode = params.get(OLD_SAFE_MODE_KEY);
+            if (oldSafeMode != null)
+            {
+                // copy it under the new one
+                params.put(SAFE_MODE_KEY, oldSafeMode);
+            }
+            super.configure(params);
+        }
+    }
+
 }



Mime
View raw message