You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sm...@apache.org on 2006/12/01 11:06:39 UTC

svn commit: r481214 - /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java

Author: smilek
Date: Fri Dec  1 02:06:38 2006
New Revision: 481214

URL: http://svn.apache.org/viewvc?view=rev&rev=481214
Log:
add velocity EscapeTool to ajaxapi velocity contexts

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java?view=diff&rev=481214&r1=481213&r2=481214
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/ajax/AjaxRequestServiceImpl.java Fri Dec  1 02:06:38 2006
@@ -33,6 +33,7 @@
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
+import org.apache.velocity.tools.generic.EscapeTool;
 
 /**
  * 
@@ -78,11 +79,15 @@
     // Default Action if no action specified
     protected String defaultAction = "getpage";
     
+    // Handy Velocity Escape Tool (is threadsafe)
+    protected EscapeTool velocityEscTool = null;
+    
     // Spring can be used to inject this information
     public AjaxRequestServiceImpl(Map objects, VelocityEngine velocityEngine)
     {
         this.objects = objects;
         this.velocityEngine = velocityEngine;
+        this.velocityEscTool = new EscapeTool();
     }
 
     // Spring can be used to inject this information
@@ -91,7 +96,8 @@
     {
         this.objects = objects;
         this.velocityEngine = velocityEngine;
-        this.urlParameterName = urlParameterName;        
+        this.urlParameterName = urlParameterName;
+        this.velocityEscTool = new EscapeTool();
     }
     
     // This is the entry point for this service
@@ -180,6 +186,7 @@
             }
             
             Context context = new VelocityContext(inputMap);
+            context.put("esc", this.velocityEscTool);
             
             // Check to see if we have a valid context
             if (result)



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