AdjustingForInflation
AdjustingForInflation

Reputation: 1611

Add servlet filter to a Grails app dynamically

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?

Upvotes: 2

Views: 743

Answers (1)

Graeme Rocher
Graeme Rocher

Reputation: 7985

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

Upvotes: 3

Related Questions