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