1. All filters with matching url patterns are located first.Filters with matching url patterns are placed in the chain in the order in which they are declared in the DD.
2. Once the filters with the matching url patterns are placed in the chain, the container does the same thing with the filters that have a matching <servlet-name> in the DD.
FilterTwo invokes after invocation of FilterThree.
If we don't mention <dispatcher> element in <filter-mapping>, or mention it as empty like then it defaults to REQUEST.
Suppose if we send request to the container like, , then container selects the appropriate filters by seeing its <url-parttern> and <dispatcher> element. Here first it sees the 'FilterOne' url-pattern(/admin/*), this is ok, and it sees its <dispatcher> entry, here it is 'FORWARD', it skip this step and moves to the next ones, 'FilterThree' and 'FilterTwo', they satisfy the rules. Finally, it makes a mapping that first I(container) should call 'FilterThree' and after I should call 'FilterTwo'.
Incase if we use RequestDispatcher to forward request to any resource like calling,
then before forwarding to the resource that was present in 'admin' directory, first it checks the <filter-mapping>'s <dispatcher> declaration, like is there is 'FORWARD' present in it? Here it is present. Then it calls the 'FilterOne's doFilter() method and if our doFilter() contains then the resource will be forward to the 'result.jsp'.
Joined: Jan 01, 2007
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com