We are aware about custom filters and built in filters available in Apache Tomcat.
If we are writing a custom java filter in our project, it will be look like follows,
This custom filter can help us to track and filter all requests coming to our webappliation, but it can not act like a global filter for all webapplications hosted in Apache Tomcat.
Apache Tomcat supports custom Valve elements which can help us to make this happen.
A Valve element represents a component that will be inserted into the request processing pipeline for the associated Catalina container (Engine, Host, or Context)
Following are the steps to implement a custom Valve in Apache Tomcat:
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/catalina -->
Thank you !!!