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:...},
@inj...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org