Re: [5.4] Get asset from code

2016-02-18 Thread Nathan Quirynen
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"; }

Re: [5.4] Get asset from code

2016-02-17 Thread JumpStart
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 > wrote: > >

Re: [5.4] Get asset from code

2016-02-17 Thread Thiago H de Paula Figueiredo
On Wed, 17 Feb 2016 14:18:33 -0200, Nathan Quirynen 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

[5.4] Get asset from code

2016-02-17 Thread Nathan Quirynen
Hi, in the progress of adapting to 5.4 I'm now moving my assets to the recomended location " src/main/resources/META-INF/assets/[path to asset]". In a page or component class I import them using: @Import(stylesheet = { "[path to asset]" }) In a template I access assets by using: ${asset:[pat