Re: global object
"Malcolm Edgar" <[email protected]> Fri, 10 Jan 2003 15:56:53 +0800
| Newsgroups | gmane.comp.java.tapestry.contrib |
|---|---|
| Message-ID | <[email protected]> |
Hi Howard, Yeah I don't mind if you move the global initialization out of ApplicationServlet into AbstractEngine and have it place it in the ServletContext, this would remove global code from ApplicationServlet and RequestContext. I think I was still thinking in terms of Servlets and initializing stuff in init(). I think you will need to initialize global in setupForRequest() as it has access to ServletContext. I would make the global servlet context attribute key constant public so that JSP code can reference it. Regards Malcolm >From: "Howard M. Lewis Ship" <[email protected]> >To: "Tapestry Contrib" <tapestry-contrib-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> >Subject: [Tapestry-contrib] global object >Date: Thu, 9 Jan 2003 21:14:06 -0500 > >I would like to discuss the global property added to IEngine. > >I would like to see the solution fleshed out a little bit. > >What I see is that, if there's a particularily named object in the servlet >context, it is accessible from the IEngine. I have to assume the intent >was to override ApplicationServlet.init() to provide Global. This is a bit >different than how many other similar constructs, such as Visit, are >implemented. > >I would like to see: > >1) An overridable method on AbstractEngine to create the Global. >2) A default implementation of getGlobal that checks for the Global in the >servlet context and, if not present, creates and stores it into the servlet >context. >3) A default implementation of createGlobal() that uses an app-spec >property to define the name of the class to instantiate (i.e., same pattern >as Visit). > >Basically, Global should be just like Visit, except shared by all >sessions/engines. > >Because creating and storing the Global will not force the creation of a >HttpSession, it should be done from setupForRequest(), like the many other >shared objects (page source, template source, etc.). > >I don't see that the Global should be any part of RequestContext. > >I like the idea of Global; I'm increasingly enamored of solutions that >leverage aggregation instead of inheritance. > >I can whip my ideas together in a few minutes; I just wanted to see what >Malcolm thinks of the changes. > >---- >Howard Lewis Ship >[email protected] >http://tapestry.sf.net > _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com