This section contains the Advantage of Servlet Filters .
Advantage of Servlet Filters
Filters not create a response like servlet. A filter is an object that can transform a request or alter a response before it reaches to a servlet and can process response before it leaves to a servlet.
Given below the advantages of Servlet Filter :
A filter can intercept a servlet's invocation before the servlet is called.
Can examine a request before a servlet is called.
Can modify the request headers and request data by providing a customized version of the request object that wraps the real request.
Can modify the response headers and response data by providing a customized version of the response object that wraps the real response.
Intercept a servlet's invocation after the servlet is called.