Why and when to perform this task
IBM Rational Application Developer or an assembly tool can configure the servlet filters. Two steps are involved in configuring a servlet filter.Steps for this task
Optionally, assign initialization parameters that get passed to the init method of the servlet filter.
After configuring the servlet filter, the web.xml application deployment descriptor contains a servlet filter configuration similar to the following example:<filter id="Filter_1">
<filter-name>LoginFilter</filter-name>
<filter-class>LoginFilter</filter-class>
<description>Performs pre-login and post-login
operation</description>
<init-param>// optional
<param-name>ParameterName</param-name>
<param-value>ParameterValue</param-value>
</init-param>
</filter>
After mapping the servlet filter to a servlet or a URL, theweb.xml application deployment descriptor contains servlet mapping similar to the following example:
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>/j_security_check</url-pattern>
// can be servlet <servlet>servletName</servlet>
</filter-mapping>
Example
You can use servlet filters to replace the CustomLoginServlet servlet, and to perform additional authentication, auditing, and logging.
Related concepts
Accessing the Samples (Samples Gallery)
Related tasks
Developing servlet filters for form login processing
Migrating from the CustomLoginServlet class to servlet filters