You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Thilo Schwidurski <th...@web.de> on 2003/02/23 23:55:07 UTC

moving templates in subdirectory

Hi,

after moving my templates to a sub-path "content/velocity", where "content"
is the same level as "WEB-INF", and adding the following entry to
velocity.property:

file.resource.loader.path = /content/velocity

(velocity.property actually is found and parsed - I verified this by
debugging. It also took a while to figure out the mistake of setting the
init-param for the maverick dispatcher-servlet context and not the velocity
context, but, oh well :-/)

Ok, were have I been.
Yes, now I have trouble with this:

org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource '/trimInside.vm'

(the path actually is "content/velocity/trimInside.vm")

The server.xml (I am using tomcat 4.1.18) contains:

<Context path="/mywebapp"
docBase="C:\dev\workspace\mywebapp"
workDir="C:\dev\workspace\mywebapp\work\org\apache\jsp" />

Now I wonder what combination of settings of docBase,
file.resource.loader.path or other path-configs I did'nt find yet will do
the trick.

Actually, as indicated earlier, I am also using maverick (that's why the
crosspost), and I started from the velocity-flavor friendbook example.
"trimInside.vm" is chained in as transformation, AFAIU, so that's were there
might be a setting I missed(?) but nevertheless, my own macro.vm, which is
properly registered in velocity.property, does'nt seem to be reached
either).

Any help would be much appreciated.

Regards,
Thilo.




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: moving templates in subdirectory

Posted by Thilo Schwidurski <th...@web.de>.
"Claude Brisson" <cl...@savoirweb.com> schrieb im Newsbeitrag
news:003201c2dc2b$edcaf1c0$0501a8c0@turin.savoirweb.com...
> Hi Thilo.
>
> This FileResourceLoader paths are not relative to the webapp.
> So specify full paths, or try the WebappResourceLoader, located in the
> tools subproject.

org.apache.velocity.tools.view.servlet.WebappLoader, right?
Thanks for the hint, Claude.

But unfortunately I also did'nt acchieve what I wanted in the first place
with this approach.

I plugged in the WebappLoader and then tried to set:

file.resource.loader.path = content/velocity

without avail. Actually, when specifying the WebappLoader as
Resource-Loader, the path-property seems to be completely ignored (the log
shows no entries, in contrast to the standard fileresourceloader).

And the source shows, that WebappLoader#getResourceStream does'nt append a
path to the reource's name but just uses
"servletContext.getResourceAsStream( name );". So how should this ever work?
Hmmm, though stuff this is... :-/

Well, but I am now at least able to specify an absolute path, and that's
fine.
Actually there was another *bad* thing to find: a space character at the end
of this line:

resource.loader = file

Important lesson learned: before going to debug I first will watch the
tomcat logs.

Kind regards,
Thilo.




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: moving templates in subdirectory

Posted by Claude Brisson <cl...@savoirweb.com>.
Hi Thilo.

This FileResourceLoader paths are not relative to the webapp.
So specify full paths, or try the WebappResourceLoader, located in the tools subproject.

CloD

----- Original Message -----
From: "Thilo Schwidurski" <th...@web.de>
To: <ve...@jakarta.apache.org>
Cc: <ma...@lists.sourceforge.net>
Sent: dimanche 23 février 2003 23:55
Subject: moving templates in subdirectory


> Hi,
>
> after moving my templates to a sub-path "content/velocity", where "content"
> is the same level as "WEB-INF", and adding the following entry to
> velocity.property:
>
> file.resource.loader.path = /content/velocity
>
> (velocity.property actually is found and parsed - I verified this by
> debugging. It also took a while to figure out the mistake of setting the
> init-param for the maverick dispatcher-servlet context and not the velocity
> context, but, oh well :-/)
>
> Ok, were have I been.
> Yes, now I have trouble with this:
>
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource '/trimInside.vm'
>
> (the path actually is "content/velocity/trimInside.vm")
>
> The server.xml (I am using tomcat 4.1.18) contains:
>
> <Context path="/mywebapp"
> docBase="C:\dev\workspace\mywebapp"
> workDir="C:\dev\workspace\mywebapp\work\org\apache\jsp" />
>
> Now I wonder what combination of settings of docBase,
> file.resource.loader.path or other path-configs I did'nt find yet will do
> the trick.
>
> Actually, as indicated earlier, I am also using maverick (that's why the
> crosspost), and I started from the velocity-flavor friendbook example.
> "trimInside.vm" is chained in as transformation, AFAIU, so that's were there
> might be a setting I missed(?) but nevertheless, my own macro.vm, which is
> properly registered in velocity.property, does'nt seem to be reached
> either).
>
> Any help would be much appreciated.
>
> Regards,
> Thilo.
>
>
>
>
> ---------------------------------------------------------------------
> 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