You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Philipp Leusmann <ph...@rwth-aachen.de> on 2007/07/23 00:00:34 UTC

ClasspathResourceLoader always caches templates

Hi,

I am trying to use the ClasspathResourceLoader in my project. All my
templates are in WEB-INF/classes.
The problem is, that changes to the templates are not used without
restarting Tomcat, which makes it very difficult to develop.
Here is my velocity.properties:

resource.loader=class
class.resource.loader.description = Velocity Classpath Resource Loader
class.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
class.resource.loader.cache = false
class.resource.loader.modificationCheckInterval = 5
velocimacro.library.autoreload=true
runtime.log.logsystem.class = org.apache.velocity.runtime.log.Log4JLogChute

Is this known behaviour for the ClassPathResourceLoader? Or did I made a
mistake in the configuration? I tried using the FileResourceLoader
before, and it worked, but I didn´t like to specify absolute paths for that.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: ClasspathResourceLoader always caches templates

Posted by Nathan Bubna <nb...@gmail.com>.
It's more of an internal piece.  So the javadoc will be your best
source of info.  We really should mention it in Velocity Engine's
resource loader docs...

http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/view/servlet/WebappLoader.html

On 7/23/07, Philipp Leusmann <ph...@rwth-aachen.de> wrote:
> Thanks for this hint, Nathan.
> But why can´t I find anything about the webappLoader in the
> Velocity(Tools) documentation?
>
> Regards,
>  Philipp
>
> Nathan Bubna schrieb:
> > You should probably use the WebappLoader in the VelocityTools project.
> > It has all the perks of the FileResourceLoader, while only requiring
> > servlet context relative paths.  :)
> >
> > On 7/22/07, Philipp Leusmann <ph...@rwth-aachen.de> wrote:
> >> Hi,
> >>
> >> I am trying to use the ClasspathResourceLoader in my project. All my
> >> templates are in WEB-INF/classes.
> >> The problem is, that changes to the templates are not used without
> >> restarting Tomcat, which makes it very difficult to develop.
> >> Here is my velocity.properties:
> >>
> >> resource.loader=class
> >> class.resource.loader.description = Velocity Classpath Resource Loader
> >> class.resource.loader.class =
> >> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> >> class.resource.loader.cache = false
> >> class.resource.loader.modificationCheckInterval = 5
> >> velocimacro.library.autoreload=true
> >> runtime.log.logsystem.class =
> >> org.apache.velocity.runtime.log.Log4JLogChute
> >>
> >> Is this known behaviour for the ClassPathResourceLoader? Or did I made a
> >> mistake in the configuration? I tried using the FileResourceLoader
> >> before, and it worked, but I didn´t like to specify absolute paths
> >> for that.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >> For additional commands, e-mail: user-help@velocity.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: ClasspathResourceLoader always caches templates

Posted by Philipp Leusmann <ph...@rwth-aachen.de>.
Thanks for this hint, Nathan.
But why can´t I find anything about the webappLoader in the
Velocity(Tools) documentation?

Regards,
 Philipp

Nathan Bubna schrieb:
> You should probably use the WebappLoader in the VelocityTools project.
> It has all the perks of the FileResourceLoader, while only requiring
> servlet context relative paths.  :)
>
> On 7/22/07, Philipp Leusmann <ph...@rwth-aachen.de> wrote:
>> Hi,
>>
>> I am trying to use the ClasspathResourceLoader in my project. All my
>> templates are in WEB-INF/classes.
>> The problem is, that changes to the templates are not used without
>> restarting Tomcat, which makes it very difficult to develop.
>> Here is my velocity.properties:
>>
>> resource.loader=class
>> class.resource.loader.description = Velocity Classpath Resource Loader
>> class.resource.loader.class =
>> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
>> class.resource.loader.cache = false
>> class.resource.loader.modificationCheckInterval = 5
>> velocimacro.library.autoreload=true
>> runtime.log.logsystem.class =
>> org.apache.velocity.runtime.log.Log4JLogChute
>>
>> Is this known behaviour for the ClassPathResourceLoader? Or did I made a
>> mistake in the configuration? I tried using the FileResourceLoader
>> before, and it worked, but I didn´t like to specify absolute paths
>> for that.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: ClasspathResourceLoader always caches templates

Posted by Nathan Bubna <nb...@gmail.com>.
You should probably use the WebappLoader in the VelocityTools project.
 It has all the perks of the FileResourceLoader, while only requiring
servlet context relative paths.  :)

On 7/22/07, Philipp Leusmann <ph...@rwth-aachen.de> wrote:
> Hi,
>
> I am trying to use the ClasspathResourceLoader in my project. All my
> templates are in WEB-INF/classes.
> The problem is, that changes to the templates are not used without
> restarting Tomcat, which makes it very difficult to develop.
> Here is my velocity.properties:
>
> resource.loader=class
> class.resource.loader.description = Velocity Classpath Resource Loader
> class.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> class.resource.loader.cache = false
> class.resource.loader.modificationCheckInterval = 5
> velocimacro.library.autoreload=true
> runtime.log.logsystem.class = org.apache.velocity.runtime.log.Log4JLogChute
>
> Is this known behaviour for the ClassPathResourceLoader? Or did I made a
> mistake in the configuration? I tried using the FileResourceLoader
> before, and it worked, but I didn´t like to specify absolute paths for that.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: ClasspathResourceLoader always caches templates

Posted by Will Glass-Husain <wg...@gmail.com>.
That's correct, there is no reloading of templates with
ClasspathResourceLoader.  This is because there is no generic way to get the
date of a resource (which is ordinarily used to check if a template is
changed).

WILL

On 7/22/07, Philipp Leusmann <ph...@rwth-aachen.de> wrote:
>
> Hi,
>
> I am trying to use the ClasspathResourceLoader in my project. All my
> templates are in WEB-INF/classes.
> The problem is, that changes to the templates are not used without
> restarting Tomcat, which makes it very difficult to develop.
> Here is my velocity.properties:
>
> resource.loader=class
> class.resource.loader.description = Velocity Classpath Resource Loader
> class.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> class.resource.loader.cache = false
> class.resource.loader.modificationCheckInterval = 5
> velocimacro.library.autoreload=true
> runtime.log.logsystem.class =
> org.apache.velocity.runtime.log.Log4JLogChute
>
> Is this known behaviour for the ClassPathResourceLoader? Or did I made a
> mistake in the configuration? I tried using the FileResourceLoader
> before, and it worked, but I didn´t like to specify absolute paths for
> that.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com