'How to specify the dispatcher type for a filter defined in a Guice Servlet Module?
I'm working on a Java based web app. We're using Guice
and its ServletModule
to configure servlets and filters.
Now, I need a Filter
to be invoked even when a request is forwarded through the dispatcher, not only on incoming requests.
In a plain JEE web app I would probably set my web.xml
this way...
<filter>
<filter-name>SomeFilter</filter-name>
<filter-class>com.acme.SomeFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
However I'm not able to do the same in Guice, where I only can write something like that...
filter("/*").through(com.acme.SomeFilter.class);
...and it seems to me I cannot explicitly specify the FORWARD
mode. So the filter does not kick in when a request is forwarded.
Do you know if there's a way I can accomplish that in Guice ?
thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|