Ok thanks guys. Didn't know I had to add "META-INF/assets/" to the path.

I also found that in a template I can also use the following to have a "dynamic built" path to the asset:

${asset:/}${pathToAsset}

public String getPathToAsset() {
    return "images/image-42.png";
}
<mailto:nat...@pensionarchitects.be>

On 18/02/16 02:50, JumpStart wrote:
For example:


@Inject
private AssetSource assetSource;

public String getImageURL() {
        return 
assetSource.getClasspathAsset("/META-INF/assets/images/image-42.png", 
currentLocale).toClientURL().toString();
}

Geoff

On 18 Feb 2016, at 3:18 am, Thiago H de Paula Figueiredo <thiag...@gmail.com> 
wrote:

On Wed, 17 Feb 2016 14:18:33 -0200, Nathan Quirynen 
<nat...@pensionarchitects.be> wrote:

Hi,
Hi!

But how can I get the asset in code? Sometimes the asset is "dynamic"
(based on other parameters).
I thought I'd use one of the methods of AssetSource, but I'm not sure
how to use it as I always get the error that Tapestry can't find the asset.
Check the AssetSource service and its methods. 
http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/services/AssetSource.html

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.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