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

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Apache Ant

Apache Ant basic tasks

In the previous post, we have learned what is Apache Ant, its features and an example to create simple build file. This post will guide you other basic ant tasks that are frequently used to create Read more…

Apache Ant

Apache Ant : Java Build Tool

Apache Ant is a Java library and command-line tool to automate the repetitive tasks and helps to build software. Ant is flexible and does not impose coding conventions. It supplies a number of built-in tasks allowing Read more…


Advantages of spring interceptor over servlet filter

Even filters can do the same things that interceptors can but interceptors can do more easily and more elegantly. Interceptors are more coupled to the request/response cycle than filters. Can inject other beans in the Read more…