You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sam Jackson <sa...@hotmail.com> on 2003/11/05 19:34:42 UTC

Including files outside of web application

Howdy,

I'm developing a web application with Velocity.  I'm using both the file and 
class resource.loaders.  For my web site, it's necessary to include a HTML 
file from another web application into my velocity templates.  Velocity 
disallows this for security reasons.

I'm wondering what approach I should use to include these files.
* It'd be great if I could include a file directly with the #include 
directive.  Is this going to be possible in the future?  Or is this a 
special case?

* My admin doesn't want me to copy the HTML files into the web app during 
the build, so that's out.

* I thought what I could do is have my servlet fetch the HTML page into a 
StringBuffer and then put that into the template through my context.

One of my thoughts is that I need to be able to run as an unpacked WAR file, 
and thus have no direct filesystem access.  If it's an unpacked WAR, is it 
possible to access another web application's files with Velocity.

thanks!

Sam

_________________________________________________________________
MSN Messenger with backgrounds, emoticons and more. 
http://www.msnmessenger-download.com/tracking/cdp_customize


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


Re: Including files outside of web application

Posted by "Marino A. Jonsson" <ma...@hotmail.com>.
> I'm wondering what approach I should use to include these files.
> * It'd be great if I could include a file directly with the #include
> directive.  Is this going to be possible in the future?  Or is this a
> special case?

In the forthcoming 1.1 release of Velocity Tools we have a tool called
ImportTool that can include any resources that a RequestDispatcher can
include, i.e. JPSs/Servlets and absolute URLs.

If that will solve your problems you can access the tool in cvs and try it
out ... after you set up the tool in toolbox.xml you just write i.e.
$import.read(http://www.someurl.com)  in your template to include the needed
resource.

cheers,
Marin�





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


Re: Including files outside of web application

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On Wednesday, November 5, 2003, at 01:34 PM, Sam Jackson wrote:

> Howdy,
>
> I'm developing a web application with Velocity.  I'm using both the 
> file and class resource.loaders.  For my web site, it's necessary to 
> include a HTML file from another web application into my velocity 
> templates.  Velocity disallows this for security reasons.
>
> I'm wondering what approach I should use to include these files.
> * It'd be great if I could include a file directly with the #include 
> directive.  Is this going to be possible in the future?  Or is this a 
> special case?
>
> * My admin doesn't want me to copy the HTML files into the web app 
> during the build, so that's out.
>
> * I thought what I could do is have my servlet fetch the HTML page 
> into a StringBuffer and then put that into the template through my 
> context.

There is a URL resource loader in the whiteboard/geir directory.  It 
was written a long time ago, and I don't remember how it works.  
However, if it works for you and you like it, we should move it to the 
contrib section of the CVS and unofficially support it.

geir

>
> One of my thoughts is that I need to be able to run as an unpacked WAR 
> file, and thus have no direct filesystem access.  If it's an unpacked 
> WAR, is it possible to access another web application's files with 
> Velocity.
>
> thanks!
>
> Sam
>
> _________________________________________________________________
> MSN Messenger with backgrounds, emoticons and more. 
> http://www.msnmessenger-download.com/tracking/cdp_customize
>
>
> ---------------------------------------------------------------------
> 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-247-1713(m)
geirm@optonline.net


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