In order to configure the WebFilter from a subclass there is a constructor allowing to pass properties which will take precedence over the FilterConfig properties ; this is fine when your are able to build at construction time the Properties object. Proxying or changing the FilterConfig is not possible since the init method is marked final.
It would be nice to allow for a more dynamic version ; probably exposing a protected Properties getProperties(FilterConfig config) method would be enough. This way one could override WebFilter and still be able to use for example CDI injected features in order to override the properties.
With the above proposal, subclasses can benefit from the FilterConfig & thus ServletContext to behave differently and to populate accordingly the Properties.
Does it make sense to add such a protected method or are there other ways to achieve such a dynamic behavior?
In order to configure the WebFilter from a subclass there is a constructor allowing to pass properties which will take precedence over the FilterConfig properties ; this is fine when your are able to build at construction time the Properties object. Proxying or changing the FilterConfig is not possible since the
init
method is marked final.It would be nice to allow for a more dynamic version ; probably exposing a
protected Properties getProperties(FilterConfig config)
method would be enough. This way one could overrideWebFilter
and still be able to use for example CDI injected features in order to override the properties.With the above proposal, subclasses can benefit from the FilterConfig & thus ServletContext to behave differently and to populate accordingly the Properties.
Does it make sense to add such a protected method or are there other ways to achieve such a dynamic behavior?