You can add or delete Web filter source code, annotated
source or compiled class files for various J2EE filter types, such
as authentication filters, encryption filters, and data compression
filters to or from a free-form project.
Before you begin
Prerequisites
The
filter class must be an implementation of the following type:
javax.servlet.Filter
Procedure
- To add Web filters into a free-form project, use your file
management system to properly place your filter artifacts into the
free-form project. The directory name of the free-form project has
the same string value you had provided for the -project parameter
used in the wrd-config command.
- The following activities occur when you drop a filter into
the free-form project:
- If necessary, the filter class is generated and mapped
to the imported_classes directory of the Web
module project. The rapid deployment tools then copy the class files
to its appropriate J2EE location which is WebContent/WEB-INF/classes folder
of the Web module project. The console output can look like this example
when adding a filter Java source
file (called MyFilter.java) to a free-form project (called MyProject):
[07:47:17 PM] [/MyProject/MyFilter.java] Added
[07:47:20 PM] [/MyProject/bin/MyFilter.class] copied to project [MyProjectWeb]
[07:47:20 PM] Web Filter added to web.xml MyFilter
[07:47:20 PM] Filter Mapping added to web.xml /MyFilter
Tip: If you want to monitor the
rapid deployment activity, run your rapid deployment session with
console output. You can complete this by running the rapid deployment
launch tool as follows:
wrd.bat -monitor
wrd.sh -monitor
- A new filter entry along with its display name, and
any initialization parameters, URL mappings, and servlet mappings
is created in the web deployment descriptor (found in the WebContent\WEB-INF\web.xml file
in the Web module project). Example of the entries in web.xml:
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>MyFilter</url-pattern>
</filter-mapping>
- The application is synchronized with the server.
- To delete Web filters from a free-form project, use your
file management system to properly remove your filter artifacts from
the free-form project. The directory name of the free-form project
has the same string value you had provided for the -project parameter
used in the wrd-config command.
- The following activities occur when you remove a filter
from the free-form project:
- The console output can look like this example when removing
a filter Java source file (called MyFilter.java)
from a free-form project (called MyProject):
[07:56:10 PM] [/MyProject/MyFilter.java] Deleted
[07:56:10 PM] [/MyProject/bin/MyFilter.class] Deleted
[07:56:10 PM] Web Filter removed from web.xml MyFilter
[07:56:10 PM] Filter Mapping removed from web.xml /MyFilter
- The application is synchronized with the server.