You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Townson, Chris" <C....@nature.com> on 2006/11/09 11:08:22 UTC

RE: FileResourceLoader and resource loaders generally: getting thecontext of a request

excellent ... I've started moving a lot of our stuff over to 1.5 recently and we're certainly planning on upgrading for production purposes asap.

Can you think of a solution for 1.4 in the meantime? ... or perhaps best not to bother with this as it looks like I would only have to remove my own implementation when we did upgrade.

I'll take a look at how it's done in that event handler.

cheers,

Chris

> -----Original Message-----
> From: Claude Brisson [mailto:claude@renegat.net] 
> Sent: 09 November 2006 10:01
> To: Velocity Users List
> Subject: Re: FileResourceLoader and resource loaders 
> generally: getting thecontext of a request
> 
> Velocity 1.5 supports relative resource loading with #include and
> #parse.
> 
> The 1.5 release is not ready yet but should be quite stable. You can
> grab it from subversion.
> 
> To enable relative resource loading, put the following line in your
> velocity.properties file:
> 
> eventhandler.include.class =
> org.apache.velocity.app.event.implement.IncludeRelativePath
> 
> 
>   Claude
> 
> Le jeudi 09 novembre 2006 à 09:38 +0000, Townson, Chris a écrit :
> > Hi all,
> > 
> > I'm just trying to work out if this is possible and how it 
> would be done:
> > 
> > The problem:
> > ------------
> > Currently, we're using FileResourceLoader to retrieve 
> templates from the filesystem in the normal. I'm in the 
> process of putting together a slightly customized version of 
> this to resolve ambiguous requests (e.g. if templateName == 
> null or length == 0, use look for a welcome file as 
> configured in web.xml) ... we need to do this because the way 
> we're running velocity is through a servlet which takes the 
> template path as a request attribute, parameter or path info.
> > 
> > However, this means that it becomes impossible to #include 
> or #parse a file without referencing it using the full path 
> (i.e. #parse("anotherFileInThisFolder.vm") fails)
> > 
> > What I would like to do is, if we get a request like this, 
> to add a test which discovers the path from _where_ the call 
> was made and then normalizes it based on that information.
> > 
> > Possible?
> > 
> > 
> > Thanks in advance,
> > 
> > Chris
> > 
> > p.s. congratulations on going TLP! :D
> > 
> > ---
> > christopher townson - new technology developer
> > nature publishing group - 4 crinan st., london
> > t. +44 (20) 7843-4644  e. c.townson@nature.com
> > 
> > 
> **************************************************************
> ******************   
> > DISCLAIMER: This e-mail is confidential and should not be 
> used by anyone who is
> > not the original intended recipient. If you have received 
> this e-mail in error
> > please inform the sender and delete it from your mailbox or 
> any other storage
> > mechanism. Neither Macmillan Publishers Limited nor any of 
> its agents accept
> > liability for any statements made which are clearly the 
> sender's own and not
> > expressly made on behalf of Macmillan Publishers Limited or 
> one of its agents.
> > Please note that neither Macmillan Publishers Limited nor 
> any of its agents
> > accept any responsibility for viruses that may be contained 
> in this e-mail or
> > its attachments and it is your responsibility to scan the 
> e-mail and 
> > attachments (if any). No contracts may be concluded on 
> behalf of Macmillan 
> > Publishers Limited or its agents by means of e-mail 
> communication. Macmillan 
> > Publishers Limited Registered in England and Wales with 
> registered number 785998 
> > Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   
> > 
> **************************************************************
> ******************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 

********************************************************************************   
DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and 
attachments (if any). No contracts may be concluded on behalf of Macmillan 
Publishers Limited or its agents by means of e-mail communication. Macmillan 
Publishers Limited Registered in England and Wales with registered number 785998 
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   
********************************************************************************

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