David G Friedman wrote: > > You need to have your Interceptor run @Before the > LifecycleStage.ActionBeanResolution stage. This is where you do your > Guice constructor instantiation and save your new bean into the request > scope (or the session scope if you used the @SessionScope annotation) > using the proper key (string matching the URL binding/path). After that > call the usual proceed() method to continue the lifecycle processing. The > regular ActionBeanResolution stage should check if your ActionBean already > exists in the appropriate scope and use it automatically. > Are you suggesting bypassing any custom ActionResolver entirely, and duplicating ActionResolution logic? I don't think I want to go down that road. I would rather have a standardized way of instantiating, like John Newman is suggesting:
John W Newman wrote: > > YES this is exactly what I was getting at with my post about configurable > class instantiation here > http://www.nabble.com/Idea-regarding-use-of-class.newInstance%28%29-and-spring-integration-to17254970.html#a17256401 > That would be absolutely awesome for DI frameworks to hook into stripes. Although I submit calling it InstanceFactory to conform to Stripes' conventions. It really wouldn't be tough to implement. Class.newInstance() is called 21 times in Stripes proper 1.5rc1. Gerald Quintana wrote: > > Is it necessary to intercept all stages and do injection at each one? > @Intercepts({LifecycleStage.ActionBeanResolution, > LifecycleStage.HandlerResolution, > LifecycleStage.BindingAndValidation, > LifecycleStage.CustomValidation, > LifecycleStage.EventHandling, > LifecycleStage.ResolutionExecution, > LifecycleStage.RequestInit, > LifecycleStage.RequestComplete}) > public class GuiceInterceptor implements Interceptor { > > If the action injected the first time during action instanciation, and > another time in the interceptor, isn't it a problem? > I think you are on to something here GĂ©rald. The reason I am doing this on all Lifecycle stages is to perform field/member injection on any interceptors during that stage. However, there is no reason to perform injection on the ActionBean / ActionBeanContext all these times. I also need to look at whether I should inject the members of an interceptor for each lifecycle stage it intercepts. The actual injection is done in StripesFakeFilterChain, if you're interested in taking a look at that as well. Thanks to everyone for your input! Sam -- View this message in context: http://www.nabble.com/Ann%3A-Stripes-guicer-%28Guice-for-Stripes%29-tp17649051p17694527.html Sent from the stripes-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users