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.
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 JavaServer Page (JSP) in the Web application. When a filter is mapped to a servlet name (servlet-mapped), it applies to a single servlet or JSP. Path-mapped filters are executed first, followed by servlet-mapped filters.
To add a filter:
Select web.xml in the WorkSpace Navigator of the Web Application Development perspective.
The web.xml editor opens.
Select the Filter tab.
The Filter page appears displaying defined filters and general information, filter mappings, initialization parameters, and icons for the selected filter.
Click Add.
A new filter is added to the Filter Elements list with the default name NewFilterx.
(Optional) Change the default filter name to a unique, logical name in the Name field of the General Information section.
Click Browse adjacent to the Filter class field and select a class.
(Optional) Type a name in the Display name field.
(Optional) Type a description in the Description field.
Click Add in the Filter Mappings section.
The URL Mapping dialog box appears.
Type the URL that you want to map to and click OK.
Click Add in the Initialization Parameters section.
The Initialization Parameter dialog box appears.
Type and name and value and click OK.
(Optional) Click Browse in the Icons section.
You can browse for and select either a small or large icon.
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com