What is the purpose of <filter>
tag in web.xml?
It allows you to declare servlet filters, which are aspects for HTTP requests. A filter chain can intercept an incoming request and/or an outgoing response and modify it as needed.
A common example is to have a filter that performs a GZIP compression on a response stream if the user's browser can accept it. This improves performance by reducing the number of bytes on the wire, provided that the savings is greater than the time to compress and decompress.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With