Reputation: 3914
This question was asked in an answer Difference between Interceptors and Filters - Is this right?, but it remained unanswered.
Can anyone please provide some real time examples on this?
As we can use both Filter and Interceptor for Pre-processing and Post-processing
of a request.
What would be the use cases(scenarios) where servlet filter is used outside of Struts2 but within the same web application?
Upvotes: 0
Views: 107
Reputation: 1302
I had some issues combining Apache Shiro (a login framework) with a Struts2 webapp. Because Struts2 was handling the actions of the login (ie using s: tags), a lot of default stuff on Shiro broke such as built-in email validations, remember me and so on.
This also caused Struts2 validation to stop working on Shiro pages (login and createuser) along with JDBC connection problems as I had Struts2 performing actions on sessionfactories built from hibernate.cfg.xml ORM configs, and non ORM connections in Shiro.ini.
In combination with other frameworks, sometimes you don't want Struts2 to handle the actions, as you will have certain issues like I described above. I'm sure there are other examples but this was something I experienced. I lost a lot of built in features provided by Apache Shiro because I had struts handling the actions.
Upvotes: 1