Filter
Learn Filter (Servlet Integration, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes Filter is a component that sits in front of servlets and can inspect or change the request and the response, then pass control on with chain.doFilter(request, response) . Typical uses : logging, authentication, CORS, compression, character encoding and request timing. Lifecycle : init() once, doFilter() for each matching request and destroy() once.