If you look at the javadoc for the ClasspathResourceLoader:

http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.html

You will notice that it doesn't honor any configuration properties.
Unfortunately for you, this is because no one has yet taken the time
to make the ClasspathResourceLoader recognize changes in the resources
it loads.  Since it doesn't do that, it was written to always cache,
assuming things never change rather than assuming they always change.
While this doesn't appear to fit your situation, it is less common for
resources on the classpath to change than for the file system.

As such people have only used the ClasspathResourceLoader in
situations where their resources do not change.  For development or
production systems where templates are modified, the
FileResourceLoader or WebappLoader (in VelocityTools) are much more
commonly used.

I think it is probably possible to patch the ClasspathResourceLoader
to recognize when things change using
ClassLoader.getResource().openConnection().getLastModified(), but no
one has been motivated to do that yet.   If you're really determined
to use the ClasspathResourceLoader, you're welcome to try patching it
yourself (and contributing the patch for us to put in the next version
of Velocity).

Otherwise, you will probably need to use a different resource loader.

On Dec 12, 2007 5:43 PM, nguyen thanh tam <[EMAIL PROTECTED]> wrote:
> Hi all.
>
>       I have a problem when i use VelocityEngine to merge template. I want
> when i change template file then my function will be merged with  the
> changed template. But it didn't. VelocityEngine allway merge the cached
> template that is used for the first time. Although, i set the not cache and
> check for update property when init VelocityEngine.
>
>      And this is my way.
>
>      // Init properties for VelocityEngine. (Iam using *
> resource.loader=class*)
>
>     // init VelocityEngine.
>
>     // merge template using mergeTemplate function or merge function on
> given template.
>
> I tested with resource loader is file and it work. So, is there a difference
> between resource loader is class and file?
> You can tell me the way to solve this problem or my way is wrong?
> Thanks
> ----------------------------------
> Tam Nguyen
>

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

Reply via email to