You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/09/14 08:32:09 UTC

DO NOT REPLY [Bug 49922] New: ApplicationFilterChain more than the same filter

https://issues.apache.org/bugzilla/show_bug.cgi?id=49922

           Summary: ApplicationFilterChain more than the same filter
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: heyoulin@hotmail.com


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;

    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 49922] ApplicationFilterChain more than the same filter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49922

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
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 .

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49922] ApplicationFilterChain more than the same filter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49922

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-10-03 13:27:35 EDT ---
Fixed in trunk and will be included in 7.0.4 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 49922] ApplicationFilterChain more than the same filter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49922

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
(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

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org