At 4:03 AM -0800 3/18/05, Konstantin Priblouda wrote:
Not exactly. I like to modify tiles controller
creation
to obtain controller class from IoC container - this
is already done for actions ( and was easy ) , but
tiles stuff is more complicated. Creation of object
and configuration of tile controller are tied tightly
and not configurable.

Hm. After a bit of poking around, I see part of a route. I'm not that familiar with NanoContainer, so the missing link is how you would make your custom subclasses of Tiles classes aware of the container in the first place.


But, Controller instances come from ComponentDefinitions, and you can provide your own implementation of TilesDefinitionFactory by specifying the "factoryClassName" property on the <plug-in> element. If your factory was aware of the IoC container, it could use it to produce definitions or at least give definitions a reference to it, so that when the definition was asked to "getOrCreateController", your custom implementation would tap into the IoC container to get that controller.

getDefinitionsFactory gets the HttpServletRequest and the ServletContext. Using conventional Spring practices, one could get a reference to the ApplicationContext (i.e. Assembler/IoC container) from the ServletContext and then use Spring as a factory for definitions and/or controllers. I'm not sure if NanoContainer works like that in any way.

That doesn't solve the whole problem, and there may still be landmines in there. But based on my (pretty limited) experience with Spring, it addresses the first question I had, which is how would Tiles even know about the IoC container.

Stepping way back, we could at least consider adjusting the TilesPreProcessor to have a protected method like "getController(ComponentDefinition)" which could be adjusted to take other routes to providing the appropriate controller. Actually, unless the chain was produced in a different way, you'd have to do more like "getController(ActionContext, ComponentDefinition)" to have a path to an IoC container which was in application scope.

The same kind of adjustment in precisely how the controller is retrieved could be done pretty easily in Struts 1.2.x if its useful.

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to