Skip to main content

Mini Project: Servlet Filters Around Spring MVC

Learn Mini Project: Servlet Filters Around Spring MVC (Filters, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Mini Real-Time Project: Servlet Filters Around Spring MVC Problem Some work must happen before Spring MVC sees the request at all: rejecting requests without an API key, adding a request id to every response, even for unknown URLs. That is the job of servlet filters, not interceptors. Requirements Write a filter that rejects requests without an X-Api-Key and stops the chain. Write a OncePerRequestFilter that adds a request id header. Show the order of the filters. Show that filters also see URLs with no controller, while interceptors do not. Concepts Used jakarta.servlet.Filter...

More lessons in Filters