portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r406643 - in /portals/jetspeed-2/trunk: components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java src/webapp/WEB-INF/assembly/administration.xml src/webapp/WEB-INF/assembly/ajax-layout.xml
Date Mon, 15 May 2006 14:48:05 GMT
Author: ate
Date: Mon May 15 07:48:02 2006
New Revision: 406643

URL: http://svn.apache.org/viewcvs?rev=406643&view=rev
Log:
Fixing Velocity error on missing VM_global_library.vm file.
See: http://issues.apache.org/jira/browse/JS2-462#action_12402321

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/administration.xml
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java?rev=406643&r1=406642&r2=406643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
Mon May 15 07:48:02 2006
@@ -53,6 +53,7 @@
 import org.apache.pluto.Constants;
 import org.apache.portals.bridges.velocity.BridgesVelocityViewServlet;
 import org.apache.velocity.Template;
+import org.apache.velocity.app.Velocity;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 import org.apache.velocity.exception.ParseErrorException;
@@ -164,6 +165,30 @@
         cacheValidationInterval = getLongInitParameter(config, CACHE_VALIDATION_INTERVAL_PARAMETER,
DEFAULT_CACHE_VALIDATION_INTERVAL);
     }
 
+    /**
+     * overriding VelocityViewServlet initialization of global Velocity to properly provide
our own velocity.properties
+     * so to prevent an ERROR logging for not finding the default global VM_global_library.vm
(which isn't available).
+     */
+    protected void initVelocity(ServletConfig config) throws ServletException
+    {
+        try
+        {
+            Velocity.setApplicationAttribute(SERVLET_CONTEXT_KEY, getServletContext());
+            Velocity.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.tools.view.servlet.ServletLogger");
+            ExtendedProperties configuration = loadConfiguration(getServletConfig());
+            configuration.addProperty("velocimacro.library", "/WEB-INF/jetspeed_macros.vm");
+            configuration.setProperty("file.resource.loader.path", getServletContext().getRealPath("/"));
+            Velocity.setExtendedProperties(configuration);
+
+            // initialize and return velocity engine
+            Velocity.init();
+        }
+        catch (Exception e)
+        {
+            log.error("initVelocity(): unable to initialize default Velocity engine", e);
+        }
+    }
+    
     /**
      * Handle the template processing request.
      *

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/administration.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/administration.xml?rev=406643&r1=406642&r2=406643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/administration.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/administration.xml Mon May 15 07:48:02
2006
@@ -24,6 +24,12 @@
   
 <bean id="adminVelocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
     <property name="resourceLoaderPath"><value>/WEB-INF/templates/</value></property>
+    <property name="velocityProperties">
+      <props>
+        <!-- clear out default global VM_global_library.vm leading to ERROR logging because
its not available -->
+        <prop key="velocimacro.library"></prop>
+      </props>
+    </property>
 </bean>
   
 <bean id='PortalAdministrationImpl' init-method="start"

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml?rev=406643&r1=406642&r2=406643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml Mon May 15 07:48:02
2006
@@ -324,6 +324,8 @@
 <bean id="AjaxVelocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
     <property name="velocityProperties">
         <props>
+            <!-- clear out default global VM_global_library.vm leading to ERROR logging
because its not available -->
+            <prop key="velocimacro.library"></prop>
             <prop key="resource.loader">class</prop>
             <prop key="class.resource.loader.class">
                 org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader



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


Mime
View raw message