I have multiple filters defined in my Google guice application. But is there a way I can disable certain filters at runtime or on application startup?
bind(MyService.class).to(MyServiceImpl.class);
filter("/*").through(MyFilter.class);
filter("/myservlet").through(MyServletFilter.class);
In the code above there are 2 filters registered; what I want is to enable/disable these filters or modify the filter chain based up some configuration like:
filters.to.disable=my.app.package.MyFilter,my.app.package.MyServletFilter
Let me know if you have any inputs or suggestions. Thanks !
I believe there is no built-in method to do it, but you could create your own utility which would accept
filters.to.disablevalue and use it to check if the filter is enabled. E.g.: