Skip to content

Clarify behaviour when the same filter is matched by several filter-mapping elements #52

Open
@glassfishrobot

Description

@glassfishrobot

The chapter 6.2.4 Configuration of Filters in a Web Application defines how a container builds the chain of filters to be applied to a particular request URI.

My question is what should happen if there are several matching filter-mappings for the same filter (either by different s, or by an and a ):
whether
a) the filter has to be called several times, as many as how many matching s are there.
or
b) the filter has to be called only once, honoring the first filter-mapping that matches,

An example:

filterA /view/* *.do

If the requested URI is "/view/bar.do", does the filter have to be called twice?

My own reading is that "a)" (multiple calls) is what is implied by that chapter, but I would like this to be mentioned explicitly.

If actually the requirement is "b)" (single call), then I would like someone to clarify what mapping takes priority when there is both an url-pattern and a servlet-name match. As the servlet-name mappings are processed first, it seems that the servlet-name mapping wins, but it is confusing as those filters are positioned later in the resulting filter chain than the ones mapped by url-patterns.

In Tomcat 7 the "b)" behaviour was implemented but with url-patterns having the priority, stemming from the following issue:
https://issues.apache.org/bugzilla/show_bug.cgi?id=49922

Metadata

Metadata

Assignees

No one assigned

    Labels

    Candidate4NextReleaseThis issues should be consider for inclusion in the next release project.QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions