On 9/1/05, Nathan Bubna <[EMAIL PROTECTED]> wrote:
> On 9/1/05, Adam Williams <[EMAIL PROTECTED]> wrote:
> > On 9/1/05, prameet sinha <[EMAIL PROTECTED]> wrote:
> > > hello everyone,
> > > how to configure properties if i want to laod a velocity template which 
> > > is not in web-inf folder.
> >
> > I had to create my own ResourceLoader, a very small interface. I
> > called it ServletContextResourceLoader. You need to give it the
> > ServletContext. To make it easier on my application, I also defined a
> > 'mount point' so that 'mytemplate.vm' could be used. Of course,
> > without that, you would need the full path relative to the context
> > directory.
> >
> > You register is like this:
> > engine = new VelocityEngine();
> > engine.setProperty(VelocityEngine.RESOURCE_LOADER, "resourceLoaderAdapter");
> > engine.setProperty("resourceLoaderAdapter.resource.loader.instance",
> > new ServletContextResourceLoader(servletContext));
> >
> > Now that I am writing this, I am recalling that I had difficulty using
> > a properties file to configure the engine - how can the ServletContext
> > instance be given to the ResourceLoader instance?
> 
> your ServletContextResourceLoader sounds a bit like the WebappLoader
> in VelocityTools
> (http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/servlet/WebappLoader.html)
> 
> for that loader, the VelocityViewServlet places the servlet context
> into the VelocityEngine's application attributes from which the
> ResourceLoader can fetch it.

Oh, right. I have embedded Velocity into Sails[1] and had looked at
that, but forgot all about it.

 adam

[1] http://www.javaonsails.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to