Index: src/java/org/sakaiproject/vm/VelocityServlet.java =================================================================== --- src/java/org/sakaiproject/vm/VelocityServlet.java (revision 74810) +++ src/java/org/sakaiproject/vm/VelocityServlet.java (working copy) @@ -30,28 +30,45 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.collections.ExtendedProperties; import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; import org.apache.velocity.context.Context; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.tools.view.servlet.VelocityViewServlet; /** *

* Responds with the expansion of a Velocity Template. The template and context references are specified in the request. *

*/ -public class VelocityServlet extends org.apache.velocity.servlet.VelocityServlet +public class VelocityServlet extends VelocityViewServlet { /** * Called by the VelocityServlet init(). We want to set a set of properties so that templates will be found in the webapp root. This makes this easier to work with as an example, so a new user doesn't have to worry about config issues when first * figuring things out */ - protected Properties loadConfiguration(ServletConfig config) throws IOException, FileNotFoundException + protected ExtendedProperties loadConfiguration(ServletConfig config) throws IOException, FileNotFoundException { - // load the properties as configured in the servlet init params - Properties p = super.loadConfiguration(config); + // This is to support old config property. + String configPath = config.getInitParameter("properties"); + ExtendedProperties p; + if (configPath != null && configPath.length() > 0) + { + p = new ExtendedProperties(); + if (!configPath.startsWith("/")) + { + configPath = "/"+configPath; + } + p.load(getServletContext().getResourceAsStream(configPath)); + } + else + { + // load the properties as configured in the servlet init params + p = super.loadConfiguration(config); + } /* * first, we set the template path for the FileResourceLoader to the root of the webapp. This probably won't work under in a WAR under WebLogic, but should under tomcat :) Index: pom.xml =================================================================== --- pom.xml (revision 74810) +++ pom.xml (working copy) @@ -36,27 +36,14 @@ org.sakaiproject.kernel sakai-component-manager - - - org.sakaiproject sakai-velocity-tool-api - - - org.sakaiproject sakai-courier-api - - - - - commons-logging commons-logging @@ -68,11 +55,30 @@ 1.1.1 - velocity + org.apache.velocity velocity - 1.3.1 + 1.6.3 - + + velocity-tools + velocity-tools + 1.4 + + + commons-collections + commons-collections + 3.1 + + + commons-digester + commons-digester + 1.8 + + + commons-lang + commons-lang + 2.1 +