jakartaee / servlet

Jakarta Servlet
https://eclipse.org/ee4j/servlet
Other
263 stars 85 forks source link

Clarify Filter Mapping ordering #318

Open gregw opened 4 years ago

gregw commented 4 years ago

Consider two filters X & Y are defined in web.xml, but with no mappings Then in 3 fragments A, B and C that have:

If a request for /foo/bar arrives what are the filters invoked:

gregw commented 4 years ago

Thanks to @janbartel for this example.

gregw commented 4 years ago

See also https://github.com/eclipse-ee4j/jakartaee-schemas/blob/11a456eb82757df7bebcf3dd717c7b5b20d21a96/jakartaee9/src/web-common_5_0.xsds#L420-L423 which suggests that ordering of invocatio is the ordering of the matching, which implies multiple invocations. But note this is contradicted by the spec document in 6.2.4 that says path matches are ordered before servlet name matches.

So a secondary question would be if name matches come after path matches, doe that over rule fragment ordering or is that only ordering within a fragment?

gregw commented 4 years ago

Updating the question for name ordering:

Consider servlet D mapped to /* with three filters X & Y & Z are defined in web.xml, but with no mappings Then in 3 fragments A, B and C that have:

If a request for /foo/bar arrives what are the filters invoked: