Forcing a call to the loadConfiguration method won't help.  That would
only try to re-init() the servlet's VelocityEngine (or something like
that), and it's not currently possible to do that.  In order to change
settings, you'll need to replace the VelocityEngine.  This is
possible, but it'll probably take a bit of work on your part.  You
need to change your VelocityViewServlet class to recognize some sort
of special "reset" servlet request. When it handles that request, it
should create a new VelocityEngine, load and set the properties on it,
call init() on that new engine, and then pass that already initialized
engine to the setVelocityEngine() method.

and wait, there's more...

if you are pointing commons-logging to the LogSystemCommonsLog class,
you will also want to pass your new engine to that class's static
setVelocityEngine() method.  and...

if you are using the WebappLoader as your ResourceLoader (which is the
default for the VVS), then you will need to set the ServletContext as
an application attribute via a call like this.

myNewEngine.setApplicationAttribute(SERVLET_CONTEXT_KEY, getServletContext());

oh, and these things should all be done *BEFORE* passing the new
engine to the VVS's setVelocityEngine() method, or else you will get
weird race condition stuff.

and of course, i've never done any of this, but it should work.  just
be sure to do all the config and setup of the new VelocityEngine
before you pass it to the setVelocityEngine() method.

On 9/3/07, Steve O'Hara <[EMAIL PROTECTED]> wrote:
> I'm extending the VelocityViewServlet class and overriding the
> loadConfiguration method to load properties from my own storage area.
> This is fine and works great, but there are circumstances within the
> application where I need to change some settings dynamically e.g.
> cacheing.
>
> Is there a way in which I can force Velocity to reload itself? i.e.
> force a call to the loadConfiguration method
>
> Thanks,
> Steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to