You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Dhruva B. Reddy" <sl...@yahoo.com> on 2004/08/13 23:52:55 UTC

RE: Templates not refreshing

OK, I tried what was suggested below, but now I seem to have the
opposite problem.  No matter how I have the caching paremeters set, it
always picks up changes immediately.  Is there something about this I
need to know that's not in the documentation?

Thanks,
Dhruva

--- "White, Tim" <Ti...@qwest.com> wrote:

> If I recall correctly, the cache refresh does not work in the webapp
> resource loader (see previous posts).  So, if your templates are
> coming from there, then that may be the issue - turn off template
> caching for the webapp loader...
> 
> HTH,
> 
> Tim
> 
> -----Original Message-----
> From: Dhruva B. Reddy
> To: Velocity Users Mailing List
> Sent: 7/29/2004 5:37 PM
> Subject: Templates not refreshing
> 
> We are using Velocity 1.4 in a web application (but in custom tag lib
> rather than with the  VelocityViewServlet), and cannot seem to get it
> to pick up templates after they have been changed (i.e., when viewing
> the page with the template in question, it always reads as it was
> when
> the application was started).
> 
> The tag does the following to get the template:
> 
> t = Velocity.getTemplate(settings.get("templateDir") +
>                                              "/" + page + ".html");
> 
> where the "page" variable is 
> 
> The properties with which Velocity is initialized follow.  Can
> someone
> tell me what I should look for?
> 
> Thanks,
> Dhruva
> 
> # specify resource loaders to use
> resource.loader = class, webapp, file
> 
> # NOTE: Leave cache set to false while developing - change to true
> when
> deploying to production.
> 
> # for the loader we call 'class', use the ClasspathResourceLoader
> class.resource.loader.description = Velocity Classpath Resource
> Loader
> class.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> class.resource.loader.cache = true
> class.resource.loader.modificationCheckInterval = 60
> 
> # for the loader we call 'webapp', use the WebappLoader
> webapp.resource.loader.description = Velocity Webapp Loader
> webapp.resource.loader.class =
> org.apache.velocity.tools.view.servlet.WebappLoader
> webapp.resource.loader.cache = true
> webapp.resource.loader.modificationCheckInterval = 60
> 
> # for the Velocity templates...
> file.resource.loader.description = Velocity template
> file.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> file.resource.loader.path = <absolute path to templates>
> file.resource.loader.cache = true
> file.resource.loader.modificationCheckInterval = 5
> 
> # log invalid template references?
> # set this to false to have a quieter velocity.log
> runtime.log.invalid.reference=false
> 
> # velocimacro settings
> velocimacro.library = globalMacros.vm
> velocimacro.permissions.allow.inline.to.replace.global=true
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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


Re: Templates not refreshing

Posted by Nathan Bubna <na...@esha.com>.
the webapp loader does not currently support modification checks due to the
weakness/lightness of the Servlet API in the area.   the canonical use is to
turn caching off during development and back on during production.  if you
truly need modification checking to work, chances are that you are in a
situation where you can use the FileResourceLoader.

Nathan Bubna
nathan@esha.com

Dhruva B. Reddy said:
> OK, I tried what was suggested below, but now I seem to have the
> opposite problem.  No matter how I have the caching paremeters set, it
> always picks up changes immediately.  Is there something about this I
> need to know that's not in the documentation?
>
> Thanks,
> Dhruva
>
> --- "White, Tim" <Ti...@qwest.com> wrote:
>
> > If I recall correctly, the cache refresh does not work in the webapp
> > resource loader (see previous posts).  So, if your templates are
> > coming from there, then that may be the issue - turn off template
> > caching for the webapp loader...
> >
> > HTH,
> >
> > Tim
> >
> > -----Original Message-----
> > From: Dhruva B. Reddy
> > To: Velocity Users Mailing List
> > Sent: 7/29/2004 5:37 PM
> > Subject: Templates not refreshing
> >
> > We are using Velocity 1.4 in a web application (but in custom tag lib
> > rather than with the  VelocityViewServlet), and cannot seem to get it
> > to pick up templates after they have been changed (i.e., when viewing
> > the page with the template in question, it always reads as it was
> > when
> > the application was started).
> >
> > The tag does the following to get the template:
> >
> > t = Velocity.getTemplate(settings.get("templateDir") +
> >                                              "/" + page + ".html");
> >
> > where the "page" variable is
> >
> > The properties with which Velocity is initialized follow.  Can
> > someone
> > tell me what I should look for?
> >
> > Thanks,
> > Dhruva
> >
> > # specify resource loaders to use
> > resource.loader = class, webapp, file
> >
> > # NOTE: Leave cache set to false while developing - change to true
> > when
> > deploying to production.
> >
> > # for the loader we call 'class', use the ClasspathResourceLoader
> > class.resource.loader.description = Velocity Classpath Resource
> > Loader
> > class.resource.loader.class =
> > org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> > class.resource.loader.cache = true
> > class.resource.loader.modificationCheckInterval = 60
> >
> > # for the loader we call 'webapp', use the WebappLoader
> > webapp.resource.loader.description = Velocity Webapp Loader
> > webapp.resource.loader.class =
> > org.apache.velocity.tools.view.servlet.WebappLoader
> > webapp.resource.loader.cache = true
> > webapp.resource.loader.modificationCheckInterval = 60
> >
> > # for the Velocity templates...
> > file.resource.loader.description = Velocity template
> > file.resource.loader.class =
> > org.apache.velocity.runtime.resource.loader.FileResourceLoader
> > file.resource.loader.path = <absolute path to templates>
> > file.resource.loader.cache = true
> > file.resource.loader.modificationCheckInterval = 5
> >
> > # log invalid template references?
> > # set this to false to have a quieter velocity.log
> > runtime.log.invalid.reference=false
> >
> > # velocimacro settings
> > velocimacro.library = globalMacros.vm
> > velocimacro.permissions.allow.inline.to.replace.global=true
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> >
> >
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>


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