Description
I would like to see an implementation of ResourceLoader that where you can pass a literal String, and that is the template. Something like this:
public class StringResourceLoader extends ResourceLoader
{
@Override
public void init( ExtendedProperties extendedProperties )
{
}
@Override
public InputStream getResourceStream( String s ) throws ResourceNotFoundException
@Override
public boolean isSourceModified( Resource resource )
@Override
public long getLastModified( Resource resource )
}
I tested this and it works, but I am assuming this could be handy for others as well.
On a side note. Why do you have all this ResourceLoaders and their configuration? Would it not be easier to just create a getTemplate( InputStream ) method, then people can get the inputstream from whereever they want? I had now go through quite some hoops with classloading because I need to use Velocity from a plugin into another system. (For those also struggeling with this, you need to call:
Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
before you create your VelocityContext, and use the ClasspathResourceLoader)