SB-44 has been filed suggesting that the TilesContextFactory and it's
usages be refactored to remove the use of static methods. This will
allow different implementations of the factory to be used as an
extension point in Tiles.
When implementing this change, one thing that will be noticed is that
several places throughout the codebase utilize the factory statically to
create a new context. Once the refactoring is done, this will no longer
be possible without either providing static access to the factory
instance or passing around a reference to it. I'd to propose the
following changes instead:
1) TilesContext is refactored into two different contexts - TilesContext
and TilesRequestContext. Only one instance of the TilesContext should
exist within the application and it will be used to provide application
scoped functions (e.g. getResource() or getInitParameters()) . The
TilesRequestContext will provide request/response specific operations
(e.g. include() or getParameters()).
2) The TilesContext is instantiated by a configured instance of the
TilesContextFactory at startup (indirectly by the TilesServlet,
TilesFilter, TilesListener or any other initialization feature the
client decides to implement).
3) In the servlet/portlet environment the TilesContext will be saved as
a ServletContext attribute and will be retrieved from here by the tags
and other dependent objects. (Other environments will need their own
mechanism and will be handled in their initialization)
4) The TilesRequestContext will be created by a method on the
TilesContext (createRequestContext(request, response).
I think that this approach provides the following advantages.
1) Ensures the consistent state of the TilesContext (there will no
longer be some instance where it can perform request scoped operations
and others where it can not)
2) Allows us to easily propagate a single TilesContext to the entire
application without needing to utilize a static factory and/or finder.
Please let me know your thoughts.
Thanks,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]