No, I didn't continue to do that. However, I chose another method, which let VelocityEngine loads all templates once the application starts.
Velocity's ResourceLoader uses a cache and will load resources while they are modified. You can configure velocity.properties such as:
#file.resource.loader.cache = true
#file.resource.loader.modificationCheckInterval = 2
webapp.resource.loader.cache = true
webapp.resource.loader.modificationCheckInterval = 2
--bluejoe
----- Original Message -----
From: "Jason Tesser" <
jasontesser@...>
To: "Velocity Users List" <
user@...>
Sent: Wednesday, July 08, 2009 6:32 PM
Subject: Re: Serialize Template Object
> Ohh I started to go there and turned back as I wasn't sure that was the best
> direction moving forward. Were you successful? Is the code open?
>
> I ended up with implementing another cache layer. We cache at the
> ResourceLoader just our velocity code which gets returned to velocity as an
> inputstream. That object is serializable. We also implement a velocity
> cache which caches a wrapper of thr Velocity Resource but as a transient
> object.
>
> So Basically if the Velocity cache returns null and the object has been
> loaded before and not modified at least the loader will return the the
> Inputstream without hitting db etc...
>
> Thanks,
> Jason Tesser
> dotCMS Lead Development Manager
> 1-305-858-1422
>
>
> On Wed, Jul 8, 2009 at 4:58 AM, bluejoe <
bluejoe2008@...> wrote:
>
>> I had the same idea some months ago, and asked if there is any exsiting
>> method to follow.
>> It seems that we have to write extra codes to serialize the ASTNodes:(
>>
>> -bluejoe
>> ----- Original Message -----
>> From: "Jason Tesser" <
jasontesser@...>
>> To: <
user@...>
>> Sent: Monday, June 29, 2009 9:49 PM
>> Subject: Serialize Template Object
>>
>>
>> >I have a need for cache purposes to serialize the Velocity Resource
>> object.
>> > I was hoping to cache the velocity code within the template and then
>> > reconstruct the template on the other end.
>> >
>> > Is there a good way to do this. I am look at the code and api and it
>> isn't
>> > obvious how.
>> >
>> > Thanks,
>> > Jason Tesser
>> > dotCMS Lead Development Manager
>> > 1-305-858-1422
>> >
>>
>