You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jose Luiz Juniot <ta...@mandic.com.br> on 2003/08/19 19:03:04 UTC
One Question
I really love Velocity, but one thing every worry me.
Why not can I load template by your full location?
Like:
Velocity.getTemplate(new File("/anything/something/mylittletemplate.vm"));
or
Velocity.getTemplate(new File("c:\\something\\mytemplate.vm"));
or
Velocity.getTemplate(new File("d:\\anything\\thetemplate.vm"));
I do not use Velocity only with Servlet. I use with regular application.
Thanks
José Luiz Junior
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: One Question
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Tuesday, August 19, 2003, at 01:03 PM, Jose Luiz Juniot wrote:
> I really love Velocity, but one thing every worry me.
>
> Why not can I load template by your full location?
>
>
> Like:
>
> Velocity.getTemplate(new
> File("/anything/something/mylittletemplate.vm"));
>
> or
>
> Velocity.getTemplate(new File("c:\\something\\mytemplate.vm"));
>
> or
>
> Velocity.getTemplate(new File("d:\\anything\\thetemplate.vm"));
>
>
>
> I do not use Velocity only with Servlet. I use with regular
> application.
Right - the simple answer is that we made the choice in the
FileResourceLoader to not allow direct access to resources, but make it
relative. I don't think it's worth debating the merits of this as it
is done :)
However, I certainly understand your concern about using Velocity
outside of the servlet environment. I use it outside of servlets as
well for a significant amount of use. To that end, I do a few things,
such as set "/" as the root for file loading, or use the helper methods
in VelocityEngine, and just feed it a Reader of my file content...
geir
>
> Thanks
> José Luiz Junior
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
--
Geir Magnusson Jr 203-956-2604(w)
Adeptra, Inc. 203-434-2093(m)
geirm@adeptra.com 203-247-1713(m)