Question

I have a scenario where, if a user gives my Grails app a certain type of input, I want to dynamically add a javax.servlet.Filter impl (MyCustomerFilter) so that all subsequent requests to the server get passed through this filter.

In other words, when the Grails app starts up, MyCustomFilter is not activated and is not in the filter chain. But when the user does something (let's say makes an AJAX call back to a server-side controller) I want to add MyCustomFilter to the filter chain and activate it (for all future/subsequent requests).

Is this possible? If so, how? If not, why?

Was it helpful?

Solution

You can't dynamically add a filter, you can however add filter that either wraps the request or just passes it along the filter chain depending on user input

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top