Not sure what I was doing wrong, but this works when added to my AppModule:

        public static void bind(ServiceBinder binder) {
binder.bind(ActionRenderResponseGenerator.class, MyActionRenderResponseGenerator .class).withId("MyActionRenderResponseGenerator");
        }

        public static void contributeServiceOverride(
@InjectService("MyActionRenderResponseGenerator") ActionRenderResponseGenerator myService,
                        MappedConfiguration<Class<?>,Object> configuration) {
                configuration.add(ActionRenderResponseGenerator.class, 
myService);
        }

Thanks to some discussions archived from the list:
http://osdir.com/ml/users-tapestry-apache/2009-03/msg00614.html

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 10, 2009, at 8:05 PM, Norman Franke wrote:

On Jul 10, 2009, at 7:08 PM, Norman Franke wrote:

On Jul 10, 2009, at 6:55 PM, Howard Lewis Ship wrote:

On Fri, Jul 10, 2009 at 3:27 PM, Norman Franke<nor...@myasd.com> wrote:
First, I have a ton of DAOs that I need to bind the interface to the implementation. I'd like to do this automatically, so I don't have to keep modifying my AppModule for each DAO I create. What's the best way to go about this? I figure if I can somehow get a ClassNameLocator instance, I could just iterate through my package and do it that way. However, how do I
get a ClassNameLocator in bind(ServiceBinder)?

Look at the ServiceBinder interface; there are methods there
(especially in 5.1) that may address your needs.

I did, but how do I get a ClassNameLocator in the bind() method so I can then pass my classes to the ServiceBinder? bind() can only take a single argument, and I can't inject something into the class, since this is static.


Second, on the SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS issue, is it possible to inject my own ActionRenderResponseGenerator that does my bidding?

Not following you here ... but in 5.1 it is possible to override
contributions as well as services.

I see that the InternalModule has a buildActionRenderResponseGenerator() and I'd like replace that with my own implementation. I'm just not sure how. I've tried a number of things, including adding my own buildActionRenderResponseGenerator, which fails due to duplication. I tried an alias, but can't get that working either. What's the magic mojo to replace the ActionRenderResponseGenerator service with something else in my AppModule?

I've tried:
contributeAlias
contributeAliasOverride
contributeServiceOverride

None seem to actually override the ActionRenderResponseGenerator. Very strange.

-Norman



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


Reply via email to