We often share few common validations, logging scenarios, modify data for every request/response. To cover these scenarios with some common code, we need to intercept the incoming request and the outgoing response. To intercept the request-response, we can use the Filter interface provided in javax.servlet package. Methods provided by Filter interface: - init This method is invoked only once @Override public void init ( FilterConfig filterConfig ) throws ServletException { } - doFilter Invoked each time whenever client sends a request or server sends a response. We can perform all our logic in this method @Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } - destroy clean up and removes filter from service @Override public void destroy () { } Dependencies that are needed to define filter in Sp...