[opencms-dev] OpenCms and ZK

Christoph Schönfeld cschoenfeld at sylphen.com
Mon Nov 20 16:14:01 CET 2006


You can map a filter directly to a servlet. See the Java Servlet 
Specification SRV.6.2.4 for more information.
Extracted from page 53 and 54 (Version 2.4):

Once a filter has been declared in the deployment descriptor, the assembler
uses the <filter-mapping> element to define servlets and static 
resources in the
Web application to which the filter is to be applied. Filters can be 
associated with
a servlet using the <servlet-name> element. For example, the following code
example maps the Image Filter filter to the ImageServlet servlet:
FILTERING
Final Version
54
<filter-mapping>
<filter-name>Image Filter</filter-name>
<servlet-name>ImageServlet</servlet-name>
</filter-mapping>
Filters can be associated with groups of servlets and static content 
using the
<url-pattern> style of filter mapping:
<filter-mapping>
<filter-name>Logging Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Here the Logging Filter is applied to all the servlets and static 
content pages
in the Web application, because every request URI matches the ‘/*’ URL 
pattern.
When processing a <filter-mapping> element using the <url-pattern>
style, the container must determine whether the <url-pattern> matches the
request URI using the path mapping rules defined in Chapter SRV.11, “Mapping
Requests to Servlets”.

Christoph



More information about the opencms-dev mailing list