velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: [TOOLS] LayoutServlet finds layouts, but not templates in CP
Date Wed, 13 Oct 2004 08:24:04 GMT

Hi,

> The root of the problem is that
> java.util.jar.JarFile#getJarEntry(String name) will not return
> anything if a "/" is leading the name.  This causes
> org.apache.catalina.loader.WebappClassLoader#findResourceInternal(String
> name, String path) to return null.  This causes
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader#getResourceStream(String
> name) to return null.  This causes your ResourceNotFoundException.
> 
> If we fix ClasspathResourceLoader so it trims the leading "/"s like in
> WebappLoader, it will work.  I'm not sure if this is the right fix,
> though.  It might just be a Tomcat issue.  I'll attach the patch
> anyways.
You know what?  I think it's not the ClasspathResourceLoader's
responsibility.  It's just doing its stuff.  A better place to trim the
leading "/"s is where the template path is being created, namely
o.a.v.t.view.servlet.VelocityViewServlet#handleRequest(...).

And here's the patch to do so.

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>


Mime
View raw message