In this section, we'll see how a filter chain is constructed to handle an incoming request.
A FilterDef
represents the<filter>
element in the web application deployment descriptor. It describes a filter in terms of its name, its implementation class, and initialization parameters.
A FilterMap
, on the other hand, represents the<filter-mapping>
element. This element describes the servlet names, URL patterns, and dispatcher mappings that cause the filter to be engaged.
A FilterMap
instance defines when a filter will be invoked. By default, a filter is invoked for incoming requests. However, you can specify that a filter should be invoked even for request dispatcher actions (forwards and includes), as well as error page mechanism actions.
The specification of when the filter will be invoked is encoded as a single integer, dispatcherMapping
, whose bits are set to indicate the desired trigger actions. The servletNames
and urlPatterns
members contain the mappings for which...