[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: [T5] Asset Url is changed via domain. Meet Problems when use
From:       Fernando Padilla <fern () alum ! mit ! edu>
Date:       2009-03-27 17:24:57
Message-ID: 49CD0BE9.2090103 () alum ! mit ! edu
[Download RAW message or body]

hmm.  Is there an AssetFactory?

Tuan wrote:
> Thanks Fernando Padilla, I created AssetSourceDecorator as you said. The 
> result is
>        + For all assets are accessed by @includestylesheet, 
> @include...., It is ok.
>        + For all assets are accessed in template 
> ${asset:tapestry_banner.gif}, it is ok when end-user go to the page in 
> first time. The time after that,* it is fail, **AssetSourceDecorator is 
> not called **.*  I know assetSourceImpl make cache and check whether 
> cache to asset. But, T5 doesn't call AssetSourceDecorator  when cache 
> for the asset is avaliable. It means that there is a class checked 
> whether cache before. Do you know the class?
> 
> Actually, I met the problems (asset, asset cache ) in last month. At the 
> time, I created a service "AssetHelper" that having a method 
> "getAsset(String path)". When I want to access resource (css, js, image 
> ...), I used the service. It means that some way like that ${asset:...}, 
> @Inject@Path... can not be used
> 
> Now, I see my old way is not convenient. so, I try to solve the problem 
> by using the ways of T5 ( ${asset:tapestry_banner.gif}, ....).
> 
> This is my code:
> ------------------------------------------------------------------------
> public class AssetSourceDecorator implements AssetSource {
>    ...
>    private AssetSource _t5AssetSource;
> 
>    public AssetSourceDecorator(AssetSource assetSource) {          
> logger.info(">>>AssetSourceDecorator");
>        *_t5AssetSource = assetSource;*
>    }
> 
>    public Asset getAsset(Resource baseResource, String path, Locale 
> locale) {
>        logger.info(">>>getAsset " + path );
>       path = modifyPath(path);
>        *return _t5AssetSource.getAsset(baseResource, path, locale);*
>    }
>      ...
> }
> 
> public class AppModule {
>    public static AssetSource decorateAssetSource(AssetSource assetSource) {
>            return new AssetSourceDecorator(assetSource);
>     }
> }
> 
> ------------------------------------------------------------------------
> 
> 
> 
> Fernando Padilla wrote:
>> another thing you can play with, which is sometimes easier to 
>> integrate, is the service decoration.
>>
>> try learning about decorators.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic