Topic
2 replies Latest Post - ‏2013-05-17T19:33:18Z by gifty
danooo
danooo
1 Post
ACCEPTED ANSWER

Pinned topic Filter mapping with multiple url-patterns in WAS

‏2013-04-22T16:14:44Z |

Hi,

The following problem occurred on WAS7 and 8.
I have this filter mapping in the web.xml of my web application:

<filter-mapping>
    <filter-name>FilterXY</filter-name>
    <url-pattern>*.jsf</url-pattern>
    <url-pattern>/init/*</url-pattern>
</filter-mapping>

 

It works good for most pages, but the problem is that the filter FilterXY is applied two times in a row for the page /pages/init/home.jsf, because it matches moth url patterns.
An important thing to note is that when the application runs on JBoss, there is no problem, the filter is applies only once.

Is it normal, that if a URL is matched against more url patterns in the filter mapping, the linked filter is applied as many times as there is matches?
I have been searching for an answer for a long time, but to no conclusion. Any information would be very appreciated.

Thank you very much for your help.

Daniel.

Updated on 2013-04-22T16:20:15Z at 2013-04-22T16:20:15Z by danooo
  • bpaskin
    bpaskin
    2887 Posts
    ACCEPTED ANSWER

    Re: Filter mapping with multiple url-patterns in WAS

    ‏2013-04-23T12:55:57Z  in response to danooo

    Hi, That should not be the case.  Can you also list the other filters and mappings?  The Servlet Spec indicates that the next filter will be executed when done with the current filter. 

    Regards,

    Brian

  • gifty
    gifty
    18 Posts
    ACCEPTED ANSWER

    Re: Filter mapping with multiple url-patterns in WAS

    ‏2013-05-17T19:33:18Z  in response to danooo

    can user share the web.xml.

    The Java Servlet Spec does not define if the filterchain can or cannot have duplicate filter entries when filter is mapped to multiple url pattern which maps to inbound request uri.