Thanks to dhanji, I fixed this by using filterRegex()
instead of filter()
. In my regular expression I am using a negative lookbehind assertion. This filters all /rest/.*
URLs except the ones ending with /[0-9]/foo
.
new ServletModule() {
@Override
protected void configureServlets() {
filter("^/rest/.*(?<!/\\d/foo)$").through(ObjectifyFilter.class);
filter("^/rest/.*(?<!/\\d/foo)$").through(SomeOtherFilter.class);
}
}