velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: Custom Resource Loader
Date Mon, 13 Dec 2004 13:38:32 GMT
You can specify locale related info in custom properties.  See this example 
how the FTP username and password is set for the resource loader.
http://wiki.apache.org/jakarta-velocity/HackingVelocity


There's also a patch in Bugzilla (not yet committed) that would allow you to 
create an instance of a resource loader, programatically configure it, then 
pass it into Velocity.  This would allow Inversion of Control type setup.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28611


WILL

----- Original Message ----- 
From: "Stan Devyatovsky" <stan@devyatovsky.com>
To: "Velocity Users List" <velocity-user@jakarta.apache.org>
Sent: Monday, December 13, 2004 4:05 AM
Subject: Custom Resource Loader


> Hello,
>
> Why is it not possible to programmatically configure Velocity?
> I mean, why can't I do something like this:
>
> ===
> VelocityEngine engine = new VelocityEngine();
> engine.setResourceLoader(myCustomResourceLoader);
> ===
>
> The only possible way to specify myCustomResourceLoader is via
> .properties, but this solution doesn't give me enough flexibility.
> For example, myCustomResourceLoader could depend on the Locale like
> this:
>
> ===
>  ResourceLoader myCustomResourceLoader = new
>  LocaleAwareFileResourceLoader(locale);
>  // this resource loader would try to lookup for localized templates
>  // first for the given locale
> ===
>
> How do I do something like that?
>
> -- 
> Best regards,
> Stan                          mailto:stan@devyatovsky.com
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message