<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Monday, September 24, 2007
RequestDispatcher.forward() and filters
If you have read this post then you probably know that if you use RequestDispatcher.forward() (or RequestDispatcher.include()) the filter chain does not get re-called for the forwarded servlet/jsp. However, if you read more closely you see that Craig was talking about the 2.3 servlet spec. Since we are using tomcat 5.5 which conforms to the 2.4 spec, you should know that there's a new <dispatcher> element in the deployment descriptor with possible values REQUEST, FORWARD, INCLUDE, and ERROR. You can add any number of entries to a <filter-mapping> tag and individually decide which filter gets called when. An Example:
Subscribe to:
Post Comments (Atom)
tHANKS DUDE, U JUST MADE MY DAY ;)
ReplyDeletethank you Nir,
ReplyDeleteI'll try to explain to my pupils
ciao!
from sevilla spain
Sweet...that's exactly what I was looking for. Thanks!
ReplyDeletenow my dispatcher works gr8! thanks
ReplyDeleteChristoph
Thank you! I have been trying to figure this out all day!
ReplyDeleteThank you, big help.
ReplyDeleteThnak you, works like a charm!
ReplyDeleteReally THANKS !
ReplyDeleteYou have saved our week whit those short 7 lines... ;-)
Thnks a lot! Really helpful.
ReplyDeleteThanks Man! It helped a lot!!
ReplyDeleteMade my day :)
ReplyDeleteThanks for the details.
ReplyDeleteExactly what I was looking for !!!