I am in the process of migrating some code from Guice to Spring. guice-servlet has the nice feature that allows you to match servlet filters using regular expressions. For example I am using
filterRegex("^.*\\.cache\\..*$").through(ForceCacheFilter.class);
I need to replicate this in Spring.
I could easily write a filter that takes a regular expression and the class name of a filter to delegate to as a parameter/attribute. It would match the URL against the regexp and delegate to the filter class if required. I guess this could be taken further and have a filter that dispatches to multiple filters based on regexps - just like what Guice is doing.
What I am surprised about is that I haven't been able to find something that does this already. Maybe I haven't looked hard enough or maybe its not such a good idea?
Does something like this exist or do I need to write some code?