[ 
http://issues.apache.org/jira/browse/VELOCITY-183?page=comments#action_12329790 
] 

Will Glass-Husain commented on VELOCITY-183:
--------------------------------------------

Hi Eelco,

Going through some old issues here.  Kind of a neat implementation.  Thanks for 
contributing.

 But I'm not sure I see the use case.  Why is this helpful to the Velocity 
user?  I think this needs to be generally useful in order to go into Velocity 
core.

One possibility is to stick this code into the Velocity Wiki
http://wiki.apache.org/jakarta-velocity/ContributedCode

> StringResourceLoader
> --------------------
>
>          Key: VELOCITY-183
>          URL: http://issues.apache.org/jira/browse/VELOCITY-183
>      Project: Velocity
>         Type: Improvement
>   Components: Source
>     Versions: 1.3.1
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Eelco Hillenius
>     Assignee: Velocity-Dev List
>     Priority: Minor
>  Attachments: StringResource.java, StringResourceException.java, 
> StringResourceLoader.java, StringResourceRepository.java, 
> StringResourceRepositoryFactory.java, StringResourceRepositoryImpl.java
>
> Resource loader that works with Strings. Users should manualy add
> resources to the repository that is know by the factory of this package. 
> Below is an example configuration for this loader.
> Note that 'repositoryimpl' is not mandatory;
> if not provided, the factory will fall back on using the default
> implementation of this package.
> stringres.resource.loader.description = Velocity StringResource loader
> stringres.resource.loader.class = 
> org.apache.velocity.tools.stringresources.StringResourceLoader
> stringres.resource.loader.repositoryimpl = 
> org.apache.velocity.tools.stringresources.StringResourceRepositoryImpl
> Resources can be added to the repository like this:
> StringResourceRepositoryFactory vsRepository = null;
> vsRepository = StringResourceRepositoryFactory.getRepository();
> String myTemplateName = "/somewhere/intherepo/name";
> String myTemplateBody = "Hi, ${username}... this is a some template!";
> vsRepository.putStringResource(myTemplateName, myTemplateBody);
> After this, the templates can be retrieved as usual

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to