I'm dealing with some of the same questions and I'm also feeling
somewhat under-enlightened by the answers I've gotten, even though I'm
sure they'll make great sense some day. So the following answer might
not be the best practice.
I moved my setupForRequest() code to a requestInitialized() method in my
custom Engine. It gets called at the beginning of each request because I
registered my Engine class as a ServletRequestListener.
In web.xml:
<listener>
<listener-class>package.path.Engine</listener-class>
</listener>
In Engine.java:
public class Engine extends AbstractEngine
implements ... ServletRequestListener
{
....
public void requestInitialized(ServletRequestEvent sre) ...
Ralph Churchill wrote:
>In Tapestry3, I overrode BaseEngine's setupForRequest to retrieve a
>DataSource from JNDI, open a Connection from it and make the Connection
>accessible via static methods to my DAO classes. I closed Connection via
>overriding BaseEngine's cleanupAfterRequest. I'm doing straight JDBC -- no
>Hibernate, Spring, etc.
>
>This simple scheme has worked very well so far.
>
>I'm looking for an equivalent in Tapestry4. I have seen this sort of
>question posed numerous times, but not sufficiently answered. I'm wondering,
>what is the best way to implement functionality similar to this? I have some
>ideas: using RequestGlobals, injecting a service with a "request" or
>"thread" scope, etc.
>
>Please note: for my configuration, a servlet filter is not a viable option.
>Thanks.
>
>RMC
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]