Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Jetty 5: How to add a ServletContextListener

Hello, for years our application has been using with success an
embedded Jetty 5 to serve servlet requests.
We do not have any web.xml file, or even a WEB-INF directory;
everything is done programmatically.

Now, for a new servlet I want to have a ServletContextListener so that its
contextInitialized(ServletContextEvent event) method gets called on
startup. With a web.xml file,
I would add something like

    <listener>
        <listener-class>
            some.package.MyListener
        </listener-class>
    </listener>

I have tried calling addEventListener(listener) on
WebApplicationHandler, HttpContext and
SessionManager, but the contextInitialized method of  my listener is
never called.

Any Ideas? Thanks!

Al


Back to the top