Servlet Filter
Spring Interceptor
A Servlet Filter is used in the web layer only, you can’t use it outside of a web context.
Interceptors can be used anywhere.
For authentication of web pages, you would use a servlet filter.
Security stuff in your business layer or logging/bug tracking (a.k.a.
independent of the web layer) you would use an Interceptor.
For the Login authentication and auditing of incoming requests from web pages, we should use a servlet filter.
While for implementing your business layer logging and auditing and many other along feature we should use an Interceptor.
Filters implement javax.servlet.Filter
 Interceptors implement org.springframework.web.servlet.HandlerInterceptor
Categories: Java