Reputation: 10419
In Java, in a filter we could do:
chain.doFilter(request, response);
This mean we could use our own RequestWrappers
and do:
chain.doFilter(new RequestWrapper(request), response);
What is the equivalent to chain.doFilter
in grails? I would like to create my RequestWrapper
and then invoked the doFilter
so that the next Filter gets it?
Upvotes: 2
Views: 919
Reputation: 66069
Grails filters (as described here) are not implemented as servlet filters. I don't think that grails filters provide a way to wrap the request.
You might be able to achieve the same effect by taking advantage of the dynamic nature of groovy. For example, you could modify the metaClass of the request object to delegate certain methods to another object.
Another alternative is to use a regular servlet filter:
javax.servlet.Filter
in src/groovy
or src/java
. grails install-templates
(if you haven't already).src/templates/war/web.xml
to include <filter>
and <filter-mapping>
elements exactly as you would with a pure Java web app.Upvotes: 3