O'Reilly logo

Servlet, JSP and Spring MVC: A Tutorial by Budi Kurniawan

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

Chapter 14

Dynamic Registration and Servlet Container Initializers

Dynamic registration is a new feature in Servlet 3 for installing new web objects (servlets, filters, listeners) without reloading the application. The servlet container initializer is also a new addition in Servlet 3 that is especially useful for framework developers.

This chapter discusses both features and presents examples.

Dynamic Registration

To make dynamic registration possible, the ServletContext interface has added these methods to dynamically create a web object.

<T extends Filter> createFilter(java.lang.Class<T> clazz)
<T extends java.util.EventListener> createListener(
        java.lang.Class<T> clazz)
<T extends Servlet> createServlet(java.lang.Class<T> clazz ...

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