O'Reilly logo

Tomcat 6 Developer's Guide by Damodar Chetty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Context example

In this section, we'll modify the devguide web application to install a custom class, a context parameter, a filter, a ServletContextListener, and a ServletRequestListener. When the application is run, watch the console output to see when the filters and listeners are invoked.

Deployment descriptor

Edit the devguide web application's web.xml deployment descriptor to add in the following lines:

<listener> <listener-class> com.swengsol.listeners.MyServletContextListener </listener-class> </listener> <listener> <listener-class> com.swengsol.listeners.MyServletRequestListener </listener-class> </listener> <context-param> <param-name>contextVariable</param-name> <param-value>Example Context Value</param-value> </context-param> <filter> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required