On 6/3/07, Matt Benson <[EMAIL PROTECTED]> wrote:
--- Nathan Bubna <[EMAIL PROTECTED]> wrote:
<snip/>
> The last thing that might be handy to know is that
> you can also feed
> an already instantiated ResourceLoader into the
> system (rather than
> have it be loaded and instantiated by class name).
> If you want more
> details on that, ask away. :)
>
This is the most interesting thing to me--it seems
like a reasonable assertion to say that other APIs
intending to use Velocity under the covers would be
justified in doing things in as much a Java-centric,
and consequently as little a Velocity-centric way, and
being able to easily set up the ResourceLoader without
having to rely too much on Velocity's internal
machinery would seem to significantly decrease the
ramp-up time to productivity. IOW, I would definitely
like to know more about this subject. :)
ok, i haven't used this myself; i've only noticed it in the code. so,
this may be trickier than it seems. but here's what i see...
create or instantiate your ResourceLoader subclass...
ResourceLoader fooLoader = new FooResourceLoader();
get a handle for the Properties file you'll be using to call
velocityEngine.init(properties) with.
then, *before* you call velocityEngine.init(properties) do:
properties.setProperty("resource.loader", "foo");
properties.put("foo.resource.loader.instance", fooLoader);
then you can call velocityEngine.init(properties);
the ResourceManagerImpl should then find your ready-to-go resource
loader instance and use that.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]