You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Vincent Massol <vm...@octo.com> on 2002/10/07 11:42:27 UTC

[Jelly] From File to URI

Hi,

I have the following script:

  <fileScanner var="scanner">
    <fileset dir="${maven.cactus.conf.dir}" includes="*.jelly"/>
  </fileScanner>

  <j:forEach var="script" items="${scanner.iterator()}">
    <j:import uri="${script.path}"/>
  </j:forEach>

However, it doesn't work as ${script.path} returns a platform dependent
file name and not a URI. 

Thus, I would need to do a kind of "(new URL(script.path)).getFile()"
...

Or should the import accept a file attribute?

Thanks
-Vincent


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Jelly] From File to URI

Posted by Vincent Massol <vm...@octo.com>.

> -----Original Message-----
> From: James Strachan [mailto:james_strachan@yahoo.co.uk]
> Sent: 07 October 2002 10:49
> To: Jakarta Commons Developers List
> Subject: Re: [Jelly] From File to URI
> 
> From: "Vincent Massol" <vm...@octo.com>
> > Hi,
> >
> > I have the following script:
> >
> >   <fileScanner var="scanner">
> >     <fileset dir="${maven.cactus.conf.dir}" includes="*.jelly"/>
> >   </fileScanner>
> >
> >   <j:forEach var="script" items="${scanner.iterator()}">
> >     <j:import uri="${script.path}"/>
> >   </j:forEach>
> >
> > However, it doesn't work as ${script.path} returns a platform
dependent
> > file name and not a URI.
> 
> You could try
> 
> ${script.toURL().toString()}
> 

arg! I missed the toURL/URI() API! Sorry for that. I actually looked at
the javadoc for File before sending my question but missed it ... :(

Thanks!

> 
> > Thus, I would need to do a kind of "(new
URL(script.path)).getFile()"
> > ...
> >
> > Or should the import accept a file attribute?
> 
> Maybe we could patch the import tag to accept files as well. So...
> 
>   <j:import file="${script}"/>
> 
> would be allowed?

That was my idea but I don't think it is really needed as there is the
toURL() API for that.

Thanks James
-Vincent

> 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> __________________________________________________
> 
> Do You Yahoo!?
> 
> Everything you'll ever need on one web page
> 
> from News and Sport to Email and Music Charts
> 
> http://uk.my.yahoo.com
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Jelly] From File to URI

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Vincent Massol" <vm...@octo.com>
> Hi,
> 
> I have the following script:
> 
>   <fileScanner var="scanner">
>     <fileset dir="${maven.cactus.conf.dir}" includes="*.jelly"/>
>   </fileScanner>
> 
>   <j:forEach var="script" items="${scanner.iterator()}">
>     <j:import uri="${script.path}"/>
>   </j:forEach>
> 
> However, it doesn't work as ${script.path} returns a platform dependent
> file name and not a URI. 

You could try

${script.toURL().toString()}


> Thus, I would need to do a kind of "(new URL(script.path)).getFile()"
> ...
> 
> Or should the import accept a file attribute?

Maybe we could patch the import tag to accept files as well. So...

  <j:import file="${script}"/>

would be allowed?


James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>