another thing you can play with, which is sometimes easier to integrate,
is the service decoration.
try learning about decorators.
On 3/26/09 12:09 AM, Tuan wrote:
Hi all,
This is my problems when I use Alias or AliasOverrides. Please help me
correct them.
_*Context: *_
IndexPage.tml
<html namespace="..."/>
<t:MyComponent/>
</html>
MyComponent.tml
<t:container namespace="...">
<img src="${asset:image.gif}" alt="..."/>
</t:container>
-=> url of image.gif is ".../components/image.gif"
In my app - business logic, theme and template are used. They are
changed via *domain*. It means above image url will change via domain. Ex:
- If end user go to my app site in "domain1.com", url of image should be
"..../components/*domain1.com*/image.gif"
- ... "domain2.com", .... "..../components/*domain2.com*/image.gif"
(domain1 and domain both specify same IP)
_*My solution:*_ Override service AssetSource (trig it to change path)
MyAssetSource.java
public class MyAssetSource extends AssetSourceImpl {
...
@Override
public Asset getClasspathAsset(String path) {
path = modifyPath(path); return getClasspathAsset(path, null);
}
...
}
Then, Use MyAssetSource to override T5 AssetSource service
binder.bind(AssetSource.class, MyAssetSource.class).withId(
"MyAssetSource");
public void contributeAlias(Configuration<AliasContribution> configuration,
@InjectService("MyAssetSource") AssetSource assetSource) {
configuration
.add(AliasContribution.create(AssetSource.class, assetSource));
}
_*Problem:
*_ - T5 throws error when go to index page:
No adapter from type
org.apache.tapestry5.ioc.internal.util.ClasspathResource to type
org.apache.tapestry5.services.AssetFactory is available (registered
types are (none))
_*
*_- In another way, I use contributeAliasOverrides method but I also get
some errors. Look like I don't know how to use alias and aliasOverride!
Please tell me how use Alias or contributeAliasOverrides.
Thanks.
_*
*_
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org