You create a filter by implementing the javax.servlet.Filter interface
and providing a public constructor taking no arguments. The IDE provides a wizard
to help you create two types of filters:
A basic filter class
A filter class that wraps
the Request and Response objects prior to passing on the request.
To create a Filter:
Right-click the package where you want to put the filter and choose
New > Other from the pop-up menu.
Under Categories, select Web. Under File Types, select Filter. Click Next.
Specify the fully
qualified class name, the location and the servlet's package. Do not include
a filename extension to the class name as this is added
automatically when the file is created.
Select the Wrap Request and Response Objects checkbox if you want
the filter to wrap the request and response objects.
For example, you can extend the capabilities of the
request and response by allowing parameters to be set
on the request before it is sent to the rest of the filter chain.
Or you can keep track of the cookies that are set on the response.
Note that some servers do not handle wrappers very well for forward or
include requests.
Click Finish to register the filter in the deployment descriptor. You can also
register the filter afterwards, using
the Servlet Filters section
of the web.xml Visual Editor.
Click Next to define initialization parameters or
click Finish to accept the default configuration. The IDE opens
the filter source code in the Source Editor.
For more information about filters, see the Java Servlet Technology Documentation
available at