Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web applications > Develop web applications > Develop servlets > Develop servlets with WAS extensions


Servlet 3.0 programmatic configuration

The configuration methods, addListener, addFilter, and addServlet are introduced in the Servlet 3.0 specification.

New feature: The new methods for Servlet 3.0 are part of the ServletContext interface. We can call these methods from either a ServletContainerInitializer or a ServletContextListener.New feature:


addListener

The addGlobalListener method is deprecated in WAS v8.0. It is replaced with the addListener method.

The given listener class must implement one or more of the following interfaces:


addFilter

The addMappingFilter method is deprecated in WAS v8.0. It is replaced with the addFilter method. This method adds the filter with the given name, description, and class name to the Web application context. The registered filter might be further configured using the returned FilterRegistration object.


addServlet

The addServlet methods dynamically adds servlets to a servletContext. These methods will add the servlet with the given parameters to the web application context. The registered servlet might be further configured using the returned ServletRegistration object.


ServletContainerInitializer

When you configure a JAR file for a shared library and a ServletContainerInitializer is discovered within the JAR, the ServletContainerInitializer is invoked for every application that the shared library associates with.


Deprecated classes in Servlet 3.0

The following classes are deprecated from com.ibm.websphere.servlet.context.IBMServletContext:

There is no replacement for the removeDynamicServlet method because removing a servlet can lead to timing issues if a request was servicing that servlet at the same time. The addServlet and createServlet methods replace the addDynamicServlet method.
Manage shared libraries
addGlobalListener method (deprecated)
addMappingFilter method (deprecated)
http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletContext.html
http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletContext.html#addServlet%28java.lang.String,%20java.lang.Class%29
http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletContext.html#addServlet%28java.lang.String,%20javax.servlet.Servlet%29
http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletContext.html#addServlet%28java.lang.String,%20java.lang.String%29
http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletContext.html#createServlet%28java.lang.Class%29

+

Search Tips   |   Advanced Search