Closed tomas-langer closed 4 months ago
Current behavior: As long as you use an HttpFeature to configure a filter, it will honor its weight If you register filter using routing directly, it will be considered default weight, ordered by insertion Behavior of filters added directly from ServerFeature.setup :
Behavior before fix (where the filter comes from (weight)):
http-feature(999)
routing-first(N/A)
routing-second(N/A)
server-feature(99)
server-feature(1000)
http-feature(98)
Desired behavior after fix:
server-feature(1000)
http-feature(999)
routing-first(N/A)
routing-second(N/A)
server-feature(99)
http-feature(98)
Can we have a way to specify filter weight if using the following bootstrap?
final webServer = previouslyCreatedAndPopulatedServerBuilder.routing(
HttpRouting.builder().addFilter(new MyFilter())
// register other routings here...
.build()
).build();
Otherwise, the only way to do it will be to create a "for no other reason" ServerFeature... (for which there isn't even a guide today).
This is the expected ordering of features:
Anything configured in routing should honor this ordering - i.e. if a filter is registered in AccessLog feature, it should be called before any filter registered in routing.
Right now it seems that all routing filters are called first, and then filters from features (in correct order based on their weight).
This must be fixed, and a test created to validate that this ordering is honored.