![]() |
| |||||||||||||||||||||||||||||||
| Resin 3.1 Documentation Examples Changes Overview Installation Configuration Quercus SOA/IoC JSP Servlets and Filters Admin (JMX) EJB Amber Security Performance Hessian XML and XSLT Third-party Troubleshooting/FAQ Servlets Servlet Lib WebDAV run-at Filters Filter Lib FAQ |
Filter ConfigurationFilter configuration follows the Servlet 2.3 deployment descriptors. Creating and using a filter has three steps:
Some other pages which discuss filters include:
filterDefines a filter alias for later mapping.
The following example defines a filter alias 'image'
<web-app id='/'>
<filter-mapping url-pattern='/images/*'
filter-name='image'/>
<filter filter-name='image'
filter-class='test.MyImage'>
<init-param title='Hello, World'/>
</filter>
</web-app>
filter-nameAlias of the filter. filter-classClass of the filter. The CLASSPATH for filters includes the WEB-INF/classes directory and all jars in the WEB-INF/lib directory. init-paramInitializes filter variables. The full Servlet 2.3 syntax for init-param is supported and allows a simple shortcut
<web-app id='/'>
<filter filter-name='test.HelloWorld'>
<init-param foo='bar'/>
<init-param>
<param-name>baz</param-name>
<param-value>value</param-value>
</init-param>
</filter>
</web-app>
filter-mappingMaps url patterns to filters. has two children, and . selects the urls which should execute the filter.
<caucho.com>
<web-app id='/'>
<servlet servlet-name='hello'
servlet-class='test.HelloWorld'/>
<servlet-mapping url-pattern='/hello'
servlet-name='hello'/>
<filter filter-name='test-filter'
filter-class='test.MyFilter'/>
<filter-mapping url-pattern='/hello/*'
filter-name='test-filter'/>
<filter-mapping servlet-name='hello'
filter-name='test.SecondFilter'/>
</web-app>
| |||||||||||||||||||||||||||||||