Re: Please help: retrieval and proper usage of per thread DataContext

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Nov 30 2005 - 11:43:58 EST

  • Next message: Joshua Pyle: "Re: Please help: retrieval and proper usage of per thread DataContext"

    It's not a bug -- it's a "feature" :)

    Request and request attribute events are intentially unsupported by
    default in Jetty 5. You have to enable it to get that functionality.

    http://jetty.mortbay.org/jetty/doc/servlet24.html#d0e358
    http://jetty.mortbay.org/javadoc/org/mortbay/jetty/servlet/JSR154Filter.html

    I hit the same situation earlier this month. I decided to just stick
    with Servlet 2.3 and write my own filter. Greg did have a good point
    in that this is pretty trivial to implement yourself with a filter.

    On 11/30/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > I confirmed - this is a bug in Jetty. I get the same results as you
    > do on Jetty 5.1.3, while on Tomcat "requestInitialized" and
    > "requestDestroyed" are being called just fine. Haven't tried Jetty 6
    > yet.
    >
    > As a workaround that works on all servers with both servlet spec 2.3
    > and 2.4, I suggest using WebApplicationContextFilter instead of the
    > listener. Here is a snip from a sample web.xml
    >
    >
    > <filter>
    > <filter-name>CayenneFilter</filter-name>
    > <filter-
    > class>org.objectstyle.cayenne.conf.WebApplicationContextFilter</
    > filter-class>
    > </filter>
    > <filter-mapping>
    > <filter-name>CayenneFilter</filter-name>
    > <url-pattern>/*</url-pattern>
    > </filter-mapping>
    >
    > This is taken from Example #2 on Wiki:
    >
    > http://objectstyle.org/confluence/display/CAY/Cayenne+Examples)
    >
    > Andrus
    >
    > On Nov 30, 2005, at 3:45 AM, Joseph Hannon wrote:
    > > Andrus,
    > >
    > > A little more testing- thanks for the debug tip! I subclassed
    > > WebApplicationContextProvider and overrode all the relevant methods
    > > including "requestInitialized" to allow dubug log statements.
    > > "requestInitialized" is not called for some reason, but methods
    > > around it are. My results are below. I upgraded to Jetty 5.1.6 to
    > > see if that would help, it did not. Could try it in Tomcat to see
    > > if there is any change, wouldn't expect a change. I may need to do
    > > as you suggest with ServletUtil. I am also unaware of how to get
    > > the session at that point.
    > >
    > > Joseph
    > >
    > > App startup:
    > >
    > > (main) DEBUG foo.bar.utility.DataContextProvider.<init>()
    > > (main) DEBUG foo.bar.utility.DataContextProvider.contextInitialized()
    > >
    > > Going to Page 1 (reads from DB)
    > >
    > > (SunJsseListener1-1) DEBUG
    > > foo.bar.utility.DataContextProvider.sessionCreated()
    > > (SunJsseListener1-1) DEBUG
    > > foo.bar.utility.DataContextProvider.getConfiguration()
    > >
    > > Submit Page 1
    > > Going to Page 2 (reads from DB)
    > > Submit Page 2 (writes to DB)
    > >
    > > (SunJsseListener1-0) DEBUG
    > > foo.bar.utility.DataContextProvider.sessionDestroyed()
    > >
    > > Complete.
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Nov 30 2005 - 11:44:02 EST