You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Keith R. Bennett" <kb...@sms-fed.com> on 2006/06/14 20:40:54 UTC
Can I Create a Template with the Template Text Itself?
Hello...
I would like to do *both of* the following with my templates:
* use a template created from a string created in memory at runtime (as
one can do with evaluate()).
* have template caching (as one can do with template.merge()).
In other words, I'd like to create a cached template by providing the
template text itself (rather than a filespec, etc.), thereby bypassing
Velocity's resource management system.
If Velocity provides caching for files, whose contents may change over
time, why would it not provide caching for strings whose contents would
*never* change?
This would enable the programmer to:
1) embed template strings in test classes (without the need to create a
temporary file with their contents). (Using evaluate() just for testing
is not acceptable because I want to exercise the code that the user
would be using.)
2) support template strings that are themselves generated at runtime
3) support nonstandard data sources
I realize that a workaround would be to create a temporary file with the
string's content, but that is convoluted and I'd rather avoid it.
Thanks for any help you can offer.
- Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: How Can I Search the Archive?
Posted by Will Glass-Husain <wg...@forio.com>.
Search for StringResourceLoader.
There's a couple of archives. I like GMane.
http://news.gmane.org/gmane.comp.jakarta.velocity.user
But here's a more helpful link with some sample code:
http://issues.apache.org/jira/browse/VELOCITY-183
WILL
Keith R. Bennett wrote:
> All -
>
> Is there a way I can search the archive for a given string, say
> "String Resource Locator"?
>
> The only interface I see is to view messages by month (at
> http://mail-archives.apache.org/mod_mbox/jakarta-velocity-user/).
>
> Thanks,
> Keith
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
--
Forio Business Simulations
Will Glass-Husain
phone (415) 440-7500 x89
mobile (415) 235-4293
wglass@forio.com
www.forio.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: How Can I Search the Archive?
Posted by jian chen <ch...@gmail.com>.
You can use mail-archive.com.
Here is the link for the velocity user mailing list search page:
http://www.mail-archive.com/velocity-user%40jakarta.apache.org/
Cheers,
Jian
On 6/14/06, Keith R. Bennett <kb...@sms-fed.com> wrote:
>
> All -
>
> Is there a way I can search the archive for a given string, say "String
> Resource Locator"?
>
> The only interface I see is to view messages by month (at
> http://mail-archives.apache.org/mod_mbox/jakarta-velocity-user/).
>
> Thanks,
> Keith
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
How Can I Search the Archive?
Posted by "Keith R. Bennett" <kb...@sms-fed.com>.
All -
Is there a way I can search the archive for a given string, say "String
Resource Locator"?
The only interface I see is to view messages by month (at
http://mail-archives.apache.org/mod_mbox/jakarta-velocity-user/).
Thanks,
Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Can I Create a Template with the Template Text Itself?
Posted by Nathan Bubna <nb...@gmail.com>.
This sounds good to me. And some of this may have already been done
for you. Search the archives of the user and/or dev lists for
"StringResourceLoader". I haven't looked at it myself, so i can't
recall the details offhand, but i'm sure it would be a good place to
look.
On 6/14/06, Keith R. Bennett <kb...@sms-fed.com> wrote:
> Hello...
>
> I would like to do *both of* the following with my templates:
>
> * use a template created from a string created in memory at runtime (as
> one can do with evaluate()).
>
> * have template caching (as one can do with template.merge()).
>
> In other words, I'd like to create a cached template by providing the
> template text itself (rather than a filespec, etc.), thereby bypassing
> Velocity's resource management system.
>
> If Velocity provides caching for files, whose contents may change over
> time, why would it not provide caching for strings whose contents would
> *never* change?
>
> This would enable the programmer to:
>
> 1) embed template strings in test classes (without the need to create a
> temporary file with their contents). (Using evaluate() just for testing
> is not acceptable because I want to exercise the code that the user
> would be using.)
>
> 2) support template strings that are themselves generated at runtime
>
> 3) support nonstandard data sources
>
> I realize that a workaround would be to create a temporary file with the
> string's content, but that is convoluted and I'd rather avoid it.
>
> Thanks for any help you can offer.
>
> - Keith
>
>
> ---------------------------------------------------------------------
> 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