When i web.xml like this: <filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/app/yofc/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>*.seam</url-pattern> </filter-mapping> then ApplicationFilterChain have two same Seam Filter. this would cause some app error. Patch: void addFilter(ApplicationFilterConfig filterConfig) { for(ApplicationFilterConfig filter:filters) if(filter==filterConfig) return; if (n == filters.length) { ApplicationFilterConfig[] newFilters = new ApplicationFilterConfig[n + INCREMENT]; System.arraycopy(filters, 0, newFilters, 0, n); filters = newFilters; } filters[n++] = filterConfig; }
Fixed in trunk and will be included in 7.0.4 onwards.
While a) I do not have a use case where calling the same filter several times would be useful, and b) I find this feature of allowing only 1 instance of Filter per FilterChain useful and lessing the overall confusion, I think that this feature is not what is written in the specification. I raised https://java.net/jira/browse/SERVLET_SPEC-52 There is a test case for this feature in TestStandardContext class. See r1004006 r1022068 .
(In reply to comment #2) > While > > a) I do not have a use case where calling the same filter several times > would be useful, and > > b) I find this feature of allowing only 1 instance of Filter per FilterChain > useful and lessing the overall confusion, > > I think that this feature is not what is written in the specification. Can this not be solved by declaring the same filter twice like this: <filter> <filter-name>Filter Copy 1</filter-name> <filter-class>...</filter-class> </filter> <filter> <filter-name>Filter Copy 2</filter-name> <filter-class>...</filter-class> </filter> ... <filter-mapping> <filter-name>Filter Copy 1</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Filter Copy 1</filter-name> <url-pattern>/foo/*</url-pattern> </filter-mapping> The above should apply both filters to e.g. /foo/bar.jsp
*** Bug 63039 has been marked as a duplicate of this bug. ***