looks like I might have had another typo?

The function is "contributeAlias", not "contributeAliasOverrides". Not sure if you have already caught that.

http://tapestry.apache.org/tapestry5/guide/alias.html


but aside from that. can you put up the exact code you have?


Angelo Chen wrote:
Hi,

Thanks for the reply, I tried:
1. there is no AliasConfiguration, I replaced it with AliasContribution
2. got this error:
[ERROR] Registry Construction of service 'AliasOverrides' has failed due to
recursion: the service depends on itself in some way. Please check
org.apache.tapestry5.internal.services.AliasManagerImpl(Logger, Collection)
(at AliasManagerImpl.java:32) via
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:150) for references to another service that is itself
dependent on service 'AliasOverrides'.

any idea?


Fernando Padilla wrote:
Sadly, this feature is aliasing, not override. So technically, you should not step on the toes of the original service at all..


1) So do not use "withId("URLEncoder")", since there is already a service with that name. Try changing that to "URLEncoder2".

2) if you bind it to "URLEncoder.class", like you did, then anyone that asks for a URLEncoder (@Inject URLEncoder enc), will fail, because tapestry will see 2 possible matches. So i could bind it to your raw class for now.

I think this code will work ( but untested ).


binder.bind( MyURLEncoderImpl.class, MyURLEncoderImpl.class );

public static void contributeAliasOverrides( MyURLEncoderImpl enc, Configuration<AliasConfiguration<?>> conf ) {
   conf.add( AliasConfiguration.create( URLEncoder.class, enc ) );
}




On 3/17/09 9:44 AM, Angelo Chen wrote:
Thanks, but can't make it work, here is my code, must be missing
something:

   binder.bind(URLEncoder.class,
MyURLEncoderImpl.class).withId("URLEncoder");

    public static void contributeAliasOverrides(
             @InjectService("URLEncoder") URLEncoder urlencoder,
             Configuration<AliasContribution<?>>  configuration) {

         configuration.add(
                 AliasContribution.create(
                         URLEncoder.class, urlencoder));
     }



Ulrich Stärk wrote:
I'm sorry. It's not in the ioc documentation but in the alias section of
the user guide:
http://tapestry.apache.org/tapestry5/guide/alias.html

Uli

Ulrich Stärk schrieb:
Check the tapestry-ioc documentation on how to override a service.

Ui

Angelo Chen schrieb:
Hi,

I'd like to override the URLEncoder to allow '=' as part of URL, here
is
what I did:

  binder.bind(URLEncoder.class, URLEncoderImpl.class);

but I got this:
2009-03-17 23:58:13.215::WARN:  failed app
ava.lang.RuntimeException: Service id 'URLEncoder' has already been
defined
by org.apache.tapestry5.internal.services.URLEncoderImpl() (at
URLEncoderImpl.java:22) via
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:150) and may not be redefined by
org.abx.myapp.t5.services.URLEncoderImpl() (at URLEncoderImpl.java:22)
via
org.abx.myapp.t5.services.AppModule.bind(ServiceBinder) (at
AppModule.java:42). You should rename one of the service builder
methods.
     at
org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:170)


---------------------------------------------------------------------
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



---------------------------------------------------------------------
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

Reply via email to