hi,

inject your resource as asset:

  @Inject
  @Path("classpath:data/..../file.jpg")
  private Asset file;

and return the path:

public String getFileURL() {
        return file.toClientURL();
}

g,
kris




Von:    "Santiago W. Fernandez Lorenzo" <santiquet...@gmail.com>
An:     users@tapestry.apache.org
Datum:  30.03.2010 09:42
Betreff:        T5 - How to create a link to a resouce?



Hello,

I'm developing my first web application at Tapestry 5.

I have done a form to permit the users upload files (which are stored in
/resources/data/....), now I need to create a link to permit the users
download that files.

I tried with:

   - In the .tml file: ${file} -> It generates a link to the download
   button/link but not to the file (The link is in
http://<site>/pages/download.html
   , but the URL generated but ${file} is 
http://<site>/*pages*/<file-name>,
   this is very close that what I need that is: http://<site>/*resources*
   /<file-name>)

So, I think that I need know how to generate a "basic url", that is, how 
to
dinamically obtain a link to "http://<site>" (and not to a page), after 
that
I suppose that I can concat some Strings to obtain the final URL(because I
can generate /resources/..../<file-name>). I know that this is not the 
best
way to do it. Any better idea?

This is my first post in the list.
Thanks!

-- 
Santiago Wenceslao Fernández Lorenzo
www.santiquetzal.es

Reply via email to