@WebFilter annotation is used to define a Servlet Filter component in a web application.
A filter dynamically intercepts requests and responses. It transform or use the information contained in the requests or responses. Filters typically do not themselves create responses, but instead provide general functionality that can be attached to any type of servlet or JSP page.
In this example we are going to demonstrate how to profile internal servlets performance. We are going to create our profile filter using @WebFilter annotation. Let's consider following web.xml filter configuration first.