According to this mailinglist entry, grails filters should be invoked on a forward. which effectively causes filters to be invoked 1 + x number of forwards
.
However, in my situation i question the method of how this is done. Here is a rough mashup of my system:
- i have a filter which is invoked on the uri condition of
"/api/**"
- an urlmapping that goes something like this:
"/api/$version/$apiKey/$rest**"
$rest
may contain (as an example) the value/book/show/1
- an ApiController thats sole purpose is to forward to another uri depending on
$rest
So lets say i access the url /api/0.1/Ks38...7fn38/book/show/1
what then happens is that the api filter is invoked and it does all the
version and apiKey validatation. it then continues to forward to the
uri /book/show/1
which then invokes the Api filter a second time even though the filter is mapped up agains /api/**
and the new uri is effectively /book/...
.
Now let it be said, i agree that filters should be invoked on a
forward, but i dont agree that the api filter should be invoked a second
time when i am doing a forward to /book...
This can't be correct behaviour? can it?