On Tue, 30 Mar 2010 05:02:07 -0300, Kristian Marinkovic <kristian.marinko...@porsche.co.at> wrote:

hi,

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();
}

This works for static assets. For creating one link dynamically, inject AssetSource and use one of its methods. For assets in the context, use Asset getContextAsset(String path, Locale locale). The toString() method of Asset returns an URL for it.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to