Filter Mapping properties

A filter is a Java class that is called to process client requests or the server’s response. Filters can be used to modify the request header or the content of a servlet request or response. Chapter 23, “Using Filters and Event Listeners,” describes how to create filters.

Filters can be mapped to a URL or a servlet name. When a filter is mapped to a URL (path-mapped), the filter applies to every servlet and JSP in the Web application. When a filter is mapped to a servlet name (servlet-mapped), it applies to a single servlet or JSP. The path-mapped filters are executed first, followed by the servlet-mapped filters.

StepsMapping a filter

  1. Display the Filter Mapping tab in the Web Application Properties dialog box.

  2. Click Add. This adds a new row to the Filter Mapping list.

  3. Enter the filter properties:

    • Filter – logical name for the filter.

    • Target – servlet class name or the URL string.

    • Target Type – choose either Servlet Name or URL Pattern.

    • Description – brief description of the filter’s purpose.