You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Vinay_s <vi...@gmail.com> on 2009/08/24 15:34:33 UTC

Velocity - Resource Loader Caching Issue

Hi Guys,

Need help in resolving an issue.

My webapp has a singleton VelocityEngine implementation.


private static VelocityEngine ve;

static{
Properties properties = new Properties();
properties.setProperty("resource.loader", "class");
properties.setProperty("class.resource.loader.class",					
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
properties.setProperty("class.resource.loader.cache","true");
properties.setProperty("class.resource.loader.modificationCheckInterval",
"1");
ve = new VelocityEngine();
ve.init(properties);
}

Now using the above ve, i create a new context every time and merge the data
values.

However, when I change the template, and try to render the data

The resource loader is still loading the old template and not picking up the
newly saved template.

What Could I be doing wrong?

Please advise.

Thanks,
Vinay
			
-- 
View this message in context: http://www.nabble.com/Velocity---Resource-Loader-Caching-Issue-tp25116178p25116178.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: AW: Velocity - Resource Loader Caching Issue

Posted by Vinay_s <vi...@gmail.com>.
Hi Johann,

My apologies. I seem to have posted wrong code. In my code, I have cache set
to false, but it doesn't seem to work.

Any other way out?

Thanks,
Vinay


Johann.Weber wrote:
> 
> Hi,
> 
> It seems that the ClasspathResourceLoader doesn't consider the
> modificationCheckInterval property. Once the template is cached, it will
> always remain as "none modified". Please try to set the
> class.resource.loader.cache property to false.
> 
> J
> 
> -----Ursprüngliche Nachricht-----
> Von: Vinay_s [mailto:vinayiyengar22@gmail.com] 
> Gesendet: Montag, 24. August 2009 15:35
> An: user@velocity.apache.org
> Betreff: Velocity - Resource Loader Caching Issue
> 
> 
> Hi Guys,
> 
> Need help in resolving an issue.
> 
> My webapp has a singleton VelocityEngine implementation.
> 
> 
> private static VelocityEngine ve;
> 
> static{
> Properties properties = new Properties();
> properties.setProperty("resource.loader", "class");
> properties.setProperty("class.resource.loader.class",					
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> properties.setProperty("class.resource.loader.cache","true");
> properties.setProperty("class.resource.loader.modificationCheckInterval",
> "1");
> ve = new VelocityEngine();
> ve.init(properties);
> }
> 
> Now using the above ve, i create a new context every time and merge the
> data
> values.
> 
> However, when I change the template, and try to render the data
> 
> The resource loader is still loading the old template and not picking up
> the
> newly saved template.
> 
> What Could I be doing wrong?
> 
> Please advise.
> 
> Thanks,
> Vinay
> 			
> -- 
> View this message in context:
> http://www.nabble.com/Velocity---Resource-Loader-Caching-Issue-tp25116178p25116178.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Velocity---Resource-Loader-Caching-Issue-tp25116178p25118072.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


AW: Velocity - Resource Loader Caching Issue

Posted by Jo...@eventim.de.
Hi,

It seems that the ClasspathResourceLoader doesn't consider the modificationCheckInterval property. Once the template is cached, it will always remain as "none modified". Please try to set the class.resource.loader.cache property to false.

J

-----Ursprüngliche Nachricht-----
Von: Vinay_s [mailto:vinayiyengar22@gmail.com] 
Gesendet: Montag, 24. August 2009 15:35
An: user@velocity.apache.org
Betreff: Velocity - Resource Loader Caching Issue


Hi Guys,

Need help in resolving an issue.

My webapp has a singleton VelocityEngine implementation.


private static VelocityEngine ve;

static{
Properties properties = new Properties();
properties.setProperty("resource.loader", "class");
properties.setProperty("class.resource.loader.class",					
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
properties.setProperty("class.resource.loader.cache","true");
properties.setProperty("class.resource.loader.modificationCheckInterval",
"1");
ve = new VelocityEngine();
ve.init(properties);
}

Now using the above ve, i create a new context every time and merge the data
values.

However, when I change the template, and try to render the data

The resource loader is still loading the old template and not picking up the
newly saved template.

What Could I be doing wrong?

Please advise.

Thanks,
Vinay
			
-- 
View this message in context: http://www.nabble.com/Velocity---Resource-Loader-Caching-Issue-tp25116178p25116178.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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