Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] Ordering Filters/Listeners

On 29/01/2023 06:20, Masao Sato wrote:
No way to put the top of order for order sensitive elements (filters
or listeners ) of web-fragment.xml .

As per section 8.2.3, if an application requires such a configuration it can do so in the application's web.xml.

why?
This restriction is designed by some historical reason?

See the Servlet 3 EG discussions for how the current solution evolved.

Or  should we discuss the optional rules to relax this restriction?

Does the current servlet specification need  2 optional features?
One is  pre-defined name for web.xml module, used in name element in
abstract-ordering or ordering elements. The other is optional flag
which treats the web.xml module as a member of  the othres elements.
These features will overwrite default ordering rule of web.xml and can
put any fragments before web.xml module.

I think this is a case of 'Where do you draw the line?' It isn't possible to have Filters from fragment A before Filters from fragment C as well as listeners from fragment C before listeners from fragment A either. Should we introduce ordering controls per configuration type?

There is a balance to strike between configuration flexibility and configuration complexity.

The current solution of "if you can't do what you want with fragment ordering, use the application's web.xml" seems to strike a reasonable balance.

I'll note that, with the rules for merging web.xml and web-fragment.xml in section 8.2.3, it is often possible to achieve the desired behaviour by only moving a few definitions to the application web.xml.

Mark


Back to the top